Downloading or Deleting Attachments from Buyers with the Event Management API

Use this procedure to download or delete attachments from buyers with the Event Management API. Buyer users can upload attachments as reference documents for terms in line items and as documents for requirements.

Context

This topic describes how to use the Event Management API to download or delete attachments that were added by buyer users. For information about downloading attachments uploaded by suppliers, see Downloading Attachments from Suppliers with the Event Management API.

Procedure

  1. Obtain the following information:
    • event ID (eventId)

    • item ID (itemId)

    • term ID (fieldId)

    • attachment ID

      • If the attachment is a reference document for a term, use the id field in the references array.

      • If the attachment is a requirement value, use the id for the attachmentValue field for the term value

    You can obtain this information from the response of a GET /events request.

    The following example shows information for an attachment added as a reference document for a term:
    {
     "title": "My event",
     "internalId": "Doc1111111",
    ...
    "items" : [ 
    ...
       { 
       "itemId": "8888888",
       "title": "My line item",
       "itemType": 4,
       "terms": [
        {
          "title": "Blueprints",
          "fieldId": "BLUEPRINTS",
          "valueTypeName": "textValue",
            ...
          "references" : [ {
            "id" : "AAAUAFvvvvvvv",
            "fileName" : "myFile.png",
            "contentType" : "image/png",
            "contentLength" : 14532
          } ]
    ...
    The following example shows information for an attachment added as a value for a requirement:
    {
     "title": "My event",
     "internalId": "Doc1111111",
    ...
    "items" : [ 
    ...
       {
       "itemId": "9999999",
       "title": "attachment item",
       "itemType": 3,
       "terms": [    
        {
          "title": "Bidding requirements",
        "fieldId": "RQAATTACH",
        "valueTypeName": "Attachment",
        "isRequirement": true,
        "value": {
           "attachmentValue": {
               "id": "AAAUAFvVmCREW",						
       ...						
  2. To download an attachment, use the following endpoiont:

    GET /events/{eventId}/items/{itemId}/attachments/{attachmentId}/content

    Specify:

    • the itemId as a path parameter

    • the attachmentId as a path parameter

    • the fieldId as a query parameter

    • isReference=true as a query parameter if the attachment is a reference document for a term

    The following example retrieves an attachment added as a reference document for a term:

    GET
    {{runtime_URL}}/events/Doc1111111/items/8888888/attachments/AAAUAFvvvvvvv/content?
    user=myuser&passwordAdapter=PasswordAdapter1&realm=mysite&fieldId=BLUEPRINTS&isReference=true

    The following example retrieves an attachment added as value for a requirement:

    GET
    {{runtime_URL}}/events/Doc1111111/items/9999999/attachments/AAAUAFvVmCREW/content?
    user=myuser&passwordAdapter=PasswordAdapter1&realm=mysite&fieldId=RQAATTACH
  3. To delete an attachment, use one of the following endpoints:
    • If the attachment is a reference document for a term:

      DELETE /events/{eventId}/items/{itemId}/attachments

      Specify:

      • The itemId as a path parameter.

      • The fieldId as a query parameter

      • The query parameter isReference=true.

      • The attachmentId in the body as an element in an array.

        For example:

        GET
        {{runtime_URL}}/events/Doc1111111/items/8888888/attachments?
        user=myuser&passwordAdapter=PasswordAdapter1&realm=mysite
        &fieldId=BLUEPRINTS&isReference=true

        Request body:

        ["AAAUAFvvvvvvv"]
    • If the attachment is a value for a requirement:

      DELETE /events/{eventId}/items/{itemId}/attachments/{attachmentId}/

      Specify:

      • The itemId as a path parameter.

      • The attachmentId as a path parameter.

      • The fieldId as a query parameter.

      For example:

      GET
      {{runtime_URL}}/events/Doc1111111/items/9999999/attachments/AAAUAFvVmCREW?
      user=myuser&passwordAdapter=PasswordAdapter1&realm=mysite
      &fieldId=RQAATTACH