Using IFS RESTful APIs


Contents

Overview

 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.

Postman is a popular tool used to test API's .In the following sections Postman has been used to demonstrate functionalities of IFS API's.

In the given examples we will be using HTTP basic authentication by enabling 'Compatibility Application Type' attribute. To learn how to authenticate using oAuth click here.

 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)

  1.  Get the Request URL for the needed GET request
        https://host:port/int/ifsapplications/projection/v1/ActivityService.svc/Activities

  2. Construct the request with the use of OpenAPI or Odata specification adhering to following standard.
        https://<server>/<resource-path>

    get without params


  3. If the request is successful server will return 200 (OK) status along with the relevant data.
    get param response
                                                                            Figure 4

Note: When server returns a large amount of data there might be performance issues, to improve this use query options.

 

Fetching data with parameters (GET operation)

  1.  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.get url with params request
    The relevant data is returnedresponse

                                                                Figure 5

 

Creating a resource ( POST operation )

  1. Construct the request URL as https://<server>/<resource-path>POST operation URL

  2. Set the body data under Body tab. Select raw and JSON type and add the necessary data.

  3.  If the operation is successful status 201 would return

 

Deleting a resource ( DELETE Operation )

  1. 1.     Construct the request URL     https://<server>/<resource-path>(ParameterKey=ParameterValue) provide the Key of the parameter and the corresponding value to be deleted.

    delete operation URL
  2.  In the headers section provide If-Match as the key and for the value provide the E-Tag value, In addition for Accept Key provide application/json as the value

    delete op

  3.  If the resource is successfully deleted 202 will return as the status value.


      Updating a resource ( PATCH Operation )

 

1. Construct the request URL as https://<server>/<resource-path>

upsert URL

2. In the headers section add Content-Type as the Key and provide application/json as the value.

upsert headers

3. In the body section select raw and JSON as the type and add the required key value pairs needed for the specific modify functionality.

upsert body

4. If the call is successful 200 is returned as the status code and the resource with the updated values is shown.

upsert success

Common issues / errors

  1. In a UD operation – A precondition is Missing in the request


    Solution – Add If-Match key for headers and for value provide the E-Tag
  2. When uploading a file - Unexpected internal server error occurred.



  3. Apart from that, the following errors appear in odp-default-log file in <ifs_home>\instance\<instance_name>\logs\odata-provider\<endpoint> folder.
    detected.com.ifsworld.fnd.provider.processor.FndErrorProcessor.processError() : Illegal base64 character 2b

    Solution - When sending Base 64 encoded filename using “X-IFS-Content-Disposition” header via REST API, it should be encoded to support Base 64 URL encoding standard. (Base 64 encoded string should not contain plus (+) and slash (/) characters.)

 

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 supports system Query options. For more details click here.

Query options help in 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.
$filter option can further restrict the data that is being returned by the URL by filtering a collection of resources that are addressed by a request URL.
$select option allows clients to requests 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.

 

Examples using query options

To only get the first 50 results
query options top

Using a combination of query options
 combination of query options