Receiving Data in Client Applications and Sending It Back to Guided Buying

This procedure describes how to receive data in client applications and send it back to guided buying. When users submit an externally managed form, guided buying sends it to your client application. Your client application receives it, processes it, and sends status information back to guided buying, which adds it the form.

Context

Guided buying calls the outbound API and later, your client application calls the inbound API.

To set up the outbound API, see Creating and Publishing an Outbound API.

The following figure illustrates how data flows from an externally managed form in guided buying to the client application, and back to guided buying.

Procedure

  1. A user fills out and submits an externally managed form and guided buying saves it in the Other requests tab in the Your requests page.
  2. Guided buying uses the value of the EXTERNALLY_MANAGED_OSG_RULE_NAME parameter to identify the client and outbound API to use.
  3. Guided buying uses the outbound API POST endpoint to send the data from the form to your client application. For example:
    POST {{runtime_url}}/externalDocuments
  4. Your client application uses the Ariba Custom Forms API to get the list of custom form instances and their field data:
    GET {{runtime_url}}/forms
  5. Your client application searches the retrieved data by formDocumentId and any date value (formCreateDate, formApprovalDate, formSubmittedDate, or formLastUpdatedDate) from the outbound API message to find custom field values.
  6. Your client application begins processing the data.

    The following points describe error handling:

    • If the outbound request fails (for example, if your client application isn't available), guided buying retries every hour up to 24 times. If there's no response after 24 attempts, guided buying discontinues and sets the status of the form to Error, which is visible to the user.

    • If you receive multiple outbound requests for the same form (for example, if guided buying is interrupted after sending the form), your client application should process the last-received form and use it to replace any existing ones.

  7. (Optional) if your client application needs to refresh its internal data with data from the form, it uses the inbound API GET endpoint:
    GET {{runtime_url}}/externalDocuments/{documentId}{realm}

    where documentId is the ID of the externally managed form assigned by guided buying and realm is the name of your guided buying realm.

    For example:

    https://openapi.ariba.com/api/externalDocuments/EM794?realm=OurRealm

    Guided buying responds with the data from the form.

  8. After your client application finishes processing the data, it creates a short status update document. For example:
    {
       "externalReferenceId": "EM794",
       "externalStatus": "Approved",
       "externalTransactionId": "DD37328",
       "externalTransactionType": "CONTRACTWORKSPACE",
       "requestedAction": "Processed"
    }

    The externalReferenceId, externalStatus, and externalTransactionId attributes can have any values.

    The externalTransactionType attribute must have the value CONTRACTCOMPLIANCE, CONTRACTWORKSPACE, or REQUISITION.

    The requestedAction attribute must have the value Processed.

  9. Your client application sends form status back to guided buying by using the inbound API PATCH endpoint:
    PATCH {{runtime_url}}/externalDocuments{documentId}
  10. Guided buying adds the received data to the form. Users can view the form in the Other requests tab in the Your requests page.