Creation of a Client Application to Use the Forms Asynchronous Reporting API
Follow these steps to create a client application using the asynchronous form documents API for SAP Ariba Procurement solutions:
-
Post the initial request to the jobs queue, using the /jobs endpoint of the Forms Asynchronous Reporting API, specifying the user name of the user initiating the request in the request header, with the job type in the query string parameter and the criteria for filtering the form documents data in the request body. This request posts a job to the queue and returns the job ID.
POST {{runtime_url}}/jobs?jobType=REPORT Request body:{ "formId":"abc12345-def67890", "formVersion":"1", "outputFormat":"CSV" "filter":"(documentStatus eq 'approved' or documentStatus eq 'submitted') and createdDate gt '2019-03-23T06:59:59.000Z' and (submittedDate ge '2019-03-23T06:59:59.000Z' or approvedDate eq '2019-03-23T06:59:59.000Z')" }Request Header Parameter: X-username
The user name of the user posting the request to create the job; this user name is returned in the response in the requestedBy field.
Request Query String Parameter: jobType
The type of job to create. Specify REPORT to request all information about the form (contents and approvals for the form) or DOCUMENT_EXPORT to request only approval information.
Request Body Parameters: formId
The form ID of the form for which to get the documents.
formVersion
The version of the form for the specified form ID, for which to get the documents.
outputFormat
The output format in which the data is downloaded. The supported formats are CSV and JSON.The default format is JSON.
filter
The OData filter to identify form document data to download. The filter consists of the following query options:
-
documentStatus: Status of the form document. The status can be one of the following:
-
Approved
-
Denied
-
Submitted
-
Composing
-
-
createdDate: Date of creation of the document in ISO8601 or GMT format.
-
submittedDate: Date of submission of the document in ISO8601 or GMT format.
-
approvedDate: Date of approval of the document in ISO8601 or GMT format.
-
lastUpdatedDate: Date of last update of the document in GMT epoch Time.
The following is an example of a valid date format: '2001-07-04T12:08:56.235+05:30'
-
-
Query the status of your reporting job using the /jobs/{jobId} endpoint of the Forms Asynchronous Reporting API. This request returns the job status.
GET {{runtime_url}}/jobs/{jobId}Job status can be one of the following:-
SUBMITTED
-
In INPROGRESS
-
COMPLETED
-
FAILED
-
-
Download the form document identified by your job, using the /reports/{reportId} endpoint of the Forms Asynchronous Reporting API. The size of the downloaded file can be up to 10 MB.
GET {{runtime_url}}/jobs/{jobId}/filesRequest Path Variable: jobId
The job ID of your reporting job.
This request downloads the report file as a ZIP file with the file name in the following format: {Form name}-{jobId}.zip.
-
Optional. Request a list of all the reporting jobs by site using the /jobs endpoint of the Forms Asynchronous Reporting API.
GET {{runtime_url}}/jobs?$filter={filter}&$top={top}&$skip={skip}Request Header Parameters: filter
The OData filter to identify the jobs to download. The filter consists of the following query options:
-
formId: The form ID of the form for which the report was downloaded.
-
formVersion: The version of the form for which the report was downloaded.
-
status: Status of the form document. The status can be one of the following:
-
Submitted
-
Retry
-
Cancelled
-
Inprogress
-
Failed
-
-
timeCreated: Date of creation of the document in ISO8601 or GMT format.
-
formName : Name of the form.
-