EDUCAÇÃO E TECNOLOGIA

Update certificate type questions via the SAP Ariba APIs

In this blog post I quickly explain how to update the details of a certificate type question in a supplier questionnaire.

In the Supplier Data API with Pagination documentation – https://help.sap.com/viewer/60ec8b8bb9344dbe8dcf15e2a1edc85b/cloud/en-US/ade8c980937c4684a8cffeec7143728d.html, it is possible to find details on how to update answers to questions. Unfortunately, it only covers answers to simple questions and attachment type questions but what about certificate type questions?

Why would you want to update certificate type questions?

It is possible that there is a third party solution where supplier certificates already exist and we just want to replicate this data to SAP Ariba. Instead of the supplier specifying the data one more time, the data can just be synced from the existing “repository”.

So, how do I update certificate questions in a supplier questionnaire?

To have an idea of the body structure required by the API for a certificate type question, I used Chromium Developer tools and captured the request sent when updating the question. Within the request I extracted the item that belongs to the certificate type question and used that as a starting point.

Chromium%20developer%20tools%20-%20submitQuestionnaire

Chromium developer tools – submitQuestionnaire

There are limitations on when you are able to update the answers of a questionnaire, e.g. can’t update an answer in any questionnaire that the supplier is currently acting on, make sure you are familiar with them. You can find the limitations here: https://help.sap.com/viewer/60ec8b8bb9344dbe8dcf15e2a1edc85b/cloud/en-US/ade8c980937c4684a8cffeec7143728d.html

Below a sample request to update a certificate type questionnaire. Notice that this request will update every single field part of the question.

curl --location --request POST 'https://openapi.ariba.com/api/supplierdatapagination/v4/prod/vendors/S350261234/workspaces/questionnaires/Doc3244061234/answers?realm=myrealm-T' \
--header 'Content-Type: application/json' \
--header 'apikey: S9f5ap58UGqw9f5a8ANamn9f5aUEg9f5a' \
--header 'Authorization: Bearer 0bad03e4-1234-1234-6789-f2f835065be1' \
--data-raw '{ "answers": [ { "externalSystemCorrelationId": "KI_12143239", "certificateAnswer": { "certified": true, "certificateType": "ISO 27001", "issuer": "SAP", "yearOfPublication": "2021", "certificateNumber": "156708", "certificateLocation": "India", "effectiveDate": "11/15/2021", "expirationDate": "11/15/2025", "description": "Certificate description", "attachment": { "fileName": "283625_Talent_Acquisition_R_purple.png", "fileSize": 30935, "fileContents": "iVBORw0KGgoAAAANSUhEUgAABAoAAA", "mimeType": "image/png", "file": {} } } } ]
}'

Once updated, check the SAP Ariba UI and there will be a new version of the questionnaire and this new version will include the answers just posted to the API.

Certificate%20type%20question%20updated%20via%20API

Certificate type question updated via API

I hope this quick blog post helps you when battling with the Supplier Data API with Pagination when trying to update certificate type questions :-).