Downloading Attachments from Suppliers with the Event Management API

This procedure describes how to use the Event Management API to download attachments submitted as responses by suppliers.

Prerequisites

Context

If a supplier bid response includes an attachment (a term or response with "valueTypeName": "Attachment"), you can download the attachment.

For information about uploading and downloading attachments added to events by buyers, see Uploading Attachments with the Event Management API and Downloading Attachments from Suppliers with the Event Management API.

Procedure

  1. Use one of the following methods to obtain the ID of the event you want to work with.
    • If the event was created using the POST /events endpoint, use the internalId in the response as the event ID.

    • If the event was created from a sourcing request received from an external system, use the GET /events endpoint and specify the RFQ ID sent by the external system (the RequestID sent in the cXML QuoteRequest) as the externalSystemCorrelationId query parameter value. Use the internalId in the response as the event ID.

    • View the event ID in the user interface. The classic SAP Ariba Sourcing user interface shows the event ID below the Overview tab, in the ID field. The guided sourcing user interface shows the event ID in the upper left corner of the event page, below the event name.

  2. Obtain the following values for a supplier bid from a GET /events response or other response that contains supplier bids:
    • eventId

    • invitationId for the supplier

    • itemId

    • fieldId for the term containing the attachment

    • attachment ID, which is the id for the attachmentValue

    In the following excerpt from a response with supplier bids, the information for item 33333 includes the term My attachment term, with the fieldId RQAATTACH. This term contains 1 attachment, and its attachment ID (id) value is AACMAFvCx+JsnE:
                         "eventId": "Doc22222",
    ...
    "supplierBids" : [ {
      "items": [ {
      "itemId": "333333",
       "title": "My item",
       "terms": [
          {
          "title": "My attachment term",
          "fieldId": "RQAATTACH",
          "valueTypeName": "Attachment",
          "acceptableValues": "AnyValue",
          "references": [],
          "value": {
             "attachmentValue": {
             "id": "AACMAFvCx+JsnE",
             "fileName": "My company 123.png",
             "contentType": "image/png",
             "contentLength": 161445
                }
             } } ]
        ...
        "invitationId": "supp_aaa"
    ...
  3. Use the following endpoint to get the attachment:
    GET /events/{eventId}/supplierBids/{invitationId}
    /attachments/{attachmentId}/content?user=user&passwordAdapter=passwordAdapter
    &realm=realm&itemId=itemId&fieldId=fieldId
                   
    For example, the request to retrieve the attachment from the previous step is:
    GET /events/Doc22222/supplierBids/supp_aaa/attachments/AACMAFvCx%2BJsnE/content?
    user=user123&passwordAdapter=PasswordAdapter1&realm=mySite
    &itemId=333333&fieldId=RQAATTACH						
    Note that the + in the attachment ID is encoded as %2B (the hexadecimal ASCII value for +) in the request.