Asynchronous APIs for SAP Ariba
The affected asynchronous APIs of SAP Ariba are the endpoints for Procurement, Sourcing and Analytical Reporting. Each API Group has multiple endpoints of which these three are used to extract data:
View management API
Job submission API
Job results API
For each API, an overview and the API limits are detailed below.
In addition, you can find the implementation and request structure to use with these APIs: Implementation and request structure.
The SAP Ariba API allows you to work with reporting view templates, which are used to specify filters and fields that determine what data will be returned in response to an API request.
A reporting view template specifies the type of records to report on, the reporting fields to be included in the API response, and selection filters to select relevant records for inclusion.
This API allows you to:
Create a reporting view template.
View metadata for a specific view template.
List all reporting view templates.
Update an existing reporting view template (view template name, view template status, select attributes and filter criteria).
API limits for the view management API
The following API limits apply:
Per second: 1 request.
Per minute: 10 requests.
Per hour: 100 requests.
Per day: 500 requests.
The SAP Ariba APIs enables you to report on the transactional data that you need to make operational decisions on.
You use the API to create a client application that extracts reportable data. The client application posts a reporting job to the jobs queue specifying a reporting view template.
API limits for the job submission API
The following API limits apply:
Per second: 1 request.
Per minute: 2 requests.
Per hour: 8 requests.
Per day: 40 requests.
This set of APIs enables an API client to query the status of a submitted job and to download the result files that are generated when the job completes successfully.
When the job is complete, the output is batched into ZIP files containing 1000 records per file. The client application requests one file at a time.
For the job results API the maximum number of records returned is 10,000 (50,000 for Analytical API), or 10 files containing 1,000 (5,000) records per file. Files created in response to an asynchronous API query expire after 48 hours.
API limits for the job result API
The following API limits apply:
Per second: 1 request.
Per minute: 20 requests.
Per hour: 200 requests.
Per day: 2000 requests.
Implementation and request structure
Ariba has a special implementation compared to other cloud connectors as it is based on the concept of view templates. To extract all custom fields, you must create a separate view template per table.
The following is an example for creating a view template for the CopyOrder table as part of the procurement process:
To authorize for the API access, a post request is sent to get the OAuth Access-Token that is used to authorize for all upcoming requests:
Post: https://api.ariba.com/v2/oauth/token HEADERS: ClientID ClientSecret
A metadata call to get all the fields of this table is then made:
Get: https://openapi.ariba.com/api/procurement-reporting-view/v2/prod/metadata?product=buyer&documentType=CopyOrder&realm=xyz&includeCustomFields=true HEADERS: Authorization Bearer xyz Apikey xyz
A custom view template is then created by including all the fields returned by metadata request:
Post: https://openapi.ariba.com/api/procurement-reporting-view/v2/prod/viewTemplates/CopyOrder_VIEW?realm=XYZ HEADERS: Authorization Bearer xyz Apikey xyz Content-Type application/json
Once a user starts an extraction, it then relies on the timeFilters provided in the table extraction configuration. If the extraction is in full mode, then it relies on the createDate, otherwise if the extraction is in delta mode it relies on the updateDate.
Based on the filters that a user has provided, you then chunk the extraction by month and submit jobs. Each job has an ID as identifier.
Post: https://openapi.ariba.com/api/procurement-reporting-job/v2/prod/jobs?includeInactive=true&realm=xyz HEADERS: Authorization Bearer xyz Apikey xyz Content-Type application/json BODY: {"viewTemplateName":"Invoice_CELONIS_VIEW_V2","filters":{"createdDateFrom":"2019-02-01T00:00:00Z","createdDateTo":"2019-03-01T00:00:00Z"}}
After the jobs have been submitted, they need some time to be processed so a job status check is made every 5 minutes until the job status is: completed, completedZeroRecords or expired.
Get: https://openapi.ariba.com/api/procurement-reporting-jobresult/v2/prod/jobs/{jobId}?realm=xyz HEADERS: Authorization Bearer xyz Apikey xyz Content-Type application/json
If the status of the job is completed this means that data is ready to be downloaded. Therefore another call is made to download the result.
Get: https://openapi.ariba.com/api/procurement-reporting-jobresult/v2/prod/jobs/88fe53b0-848e-48d8-99d4-31758a5e42b91574699039445/files/Fk3enaqz1.zip?includeInactive=true&realm=xyz HEADERS: Authorization Bearer xyz Apikey xyz Content-Type application/json
The data is then downloaded and processed.