Basic CRUD Operations on IFS APIs¶
IFS has a multitude of RESTful ODATA APIs that can be used when you want to integrate with, or extend IFS Applications.
You can read more about the concept here.
For step-wise instructions on how to perform different operations on APIs, see the API Quick Start Guide
Postman is a popular tool used to test APIs.In the following sections, Postman has been used to demonstrate functionalities of the IFS APIs.
You need to know the request URL and the HTTP method to test a request and there are many ways to achieve this.
Fetching Data Without Parameters (GET Operation)¶
-
Get the Request URL for the
GET
requesthttps://host:port/int/ifsapplications/projection/v1/ActivityService.svc/Activities
-
Construct the request with the use of OpenAPI or Odata specification adhering to the following standard.
https://<server>/<resource-path>
-
If the request is successful, the server will return
200 (OK)
status along with the relevant data.
To avoid performance issues when server returns a large amount of data, use query options.
Fetching Data With Parameters (GET Operation)¶
- Construct the request URL
https://<server>/<resource-path>
. In the Params section under query params provide the Key of the parameter and the corresponding value.The relevant data is returned
Creating a Resource (POST Operation)¶
-
Construct the request URL as
https://<server>/<resource-path>
-
Set the body data under the Body tab. Select raw and JSON type.
-
If the operation is successful, status
201
will be returned.
Deleting a Resource (DELETE Operation)¶
-
Construct the request URL
https://<server>/<resource-path>(ParameterKey=ParameterValue)
. Provide the key of the parameter and the corresponding value to be deleted. -
In the headers section provide
If-Match
as the key and for the value provide the E-Tag value. In addition, foraccept
key provide application/json as the value.
-
If the resource is successfully deleted, the
202
status will be returned.
Updating a Resource (PATCH Operation)¶
-
Construct the request URL as
https://<server>/<resource-path>
-
In the headers section, add
Content-Type
as the key and provide application/json as the value. -
In the body section, select raw and JSON as the type and add the required key-value pairs that need to be modified.
-
If the call is successful,
200
is returned as the status code and the resource with the updated values is shown.
Fetching Data With Parameters (POST/PATCH Operations)¶
-
Construct the request URL,
https://<server>/<resource-path>
. -
In the body section, select raw and JSON as the type and add the required key-value pairs needed for the specific modify functionality (It is not mandatory to use the select-fields query option).
-
In the query params section within Params, provide the key of the parameter and the corresponding value.
-
The relevant data is returned. If the call is successful,
200
is returned as the status code and the resource with the updated values and queried values are shown.
URL Encoding¶
If your request URL contains reserved characters !#$&'()*+,/:;=?@[]
as parameters or query values then those need to be URL encoded when constructing the request.
Query Options¶
Query options are a set of parameters that we can pass through the URL and control the amount of data that is being returned from the ODATA Service. IFS ODATA services support system query options. For more details, see here.
Improving Performance Aspects¶
-
The network performance can be managed by using query options such as
$filter
,$select
,$top
, and$skip
by managing the chunk of data that is sent back from the server. -
The
$filter
option can further restrict the data that is returned by the URL by filtering a collection of resources that are addressed by a request URL. -
The
$select
option allows clients to request a specific set of properties for each entity or complex type. This reduces network load. -
When going through a large number of data records, using the
$top
and$skip
options, the client can request only specific pages of items. See GET Request for examples.
To try out the other query options, see Get Request with Filter Options.