ReferenceMessaging

Attachment service

The attachment service enables partners to upload partner attachments that can be associated with messages. Partners must upload one attachment at a time, though there can be unlimited attachment IDs in a thread. It also enables lodging partners to download traveler attachments.

  • After an attachment is uploaded, it can be added to any message thread for the same property that is associated with the message thread provided while uploading the attachment.
  • Each attachment is associated with the client ID so attachment IDs are reusable for any thread on any property within that software.
  • Up to 100 attachments can be added to a message.
  • Accepted file types include PDF, JPEG, and PNG.
  • Each attachment can be up to 5MB.
  • Currently, there is no retention limit; attachments are stored indefinitely.

Note: After attachments are uploaded, use the sendMessage mutation to associate attachments with a message.

The attachment service is RESTful, and all requests and responses must be made over a secure connection. All response bodies and errors are encoded in JSON except for the download response, which is streamed data. If no response is returned within 91 seconds, the request has timed out; set your retry logic accordingly.

To test requests to the service, use a REST client such as Postman, Insomnia, or Advanced REST Client.

Endpoint

https://api.expediagroup.com/supply-lodging/v1/files

Uploading an attachment

To upload an attachment that can be added to one or more messages, use the POST method and command shown here. You need

  • a message thread ID to which the attachment will be associated (after the file is uploaded, it can be added to one or more messages associated with the same property, even if the messages belong to a different message thread ID)
  • the full path to the file (on your system)

Be sure to save the attachment ID that is returned in the response because it is needed when adding the attachment to a message.

Even though a POST is sent to the endpoint, data will only be retrieved, not modified, because the body contains queries only.

1curl --request POST \
2 --url https://api.expediagroup.com/supply-lodging/v1/files?type=messageThreadId&value=message_thread_id \
3 --header 'Authorization: Bearer token' \
4 --header 'Content-Type: multipart/form-data' \
5 --form 'content=@full_path_to_file'

Here is an example:

1curl --request POST \
2 --url https://api.expediagroup.com/supply-lodging/v1/files?type=messageThreadId&value=b3197a04-4079-478e-a67b-9e90e30036c1 \
3 --header 'Authorization: Bearer DXqM0WcAvIq2y2tskJ-bpdavLsmb42_rXE6-iudzZU8:WTAL5CBEhgZfkY3kDNEY6qD0fX2jt5mUoisWWQymjOk' \
4 --header 'Content-Type: multipart/form-data' \
5 --form 'content=@C:\Users\rmishra\Documents\Photos\Image3.jpg'

Downloading an attachment

Use the GET method as shown in this syntax statement:

1curl --request GET \
2 --url https://api.expediagroup.com/supply-lodging/v1/files/attachmentId/content?type=messageId&value=messageId \
3 --header 'Authorization: Bearer token' \

Here is an example, which returns (displays) the requested image file:

1curl --request GET \
2 --url 'https://api.expediagroup.com/supply-lodging/v1/files/ff159d64-3ad1-4e58-a097-469dfA6%5D/content?type=messageId&value=14737445-081c-4a4a-be46-7e4c7c57bfe3' \
3 --header 'Authorization: Bearer OUNgrxQQyD2ItRz3cNkhjfhidbjwVAtJyq7g1HDcJRQCKKDSuCG0w3AKmRQZBzM'

Errors

The attachment service responses can contain errors that occur during different phases of a request (authentication, validation, schema generation, and execution) as well as internal system errors. The following describes the payload of an HTTP GraphQL response:

{ 
  type: { ... }, 
  detail: [] // only present if an error occurs 
} 

Refer to the table in HTTP status codes for the list of status codes that can be returned.

Here are the error messages you might see:

  • Internal server error (status code 500):

    { 
    "type": "INTERNAL_SERVER_ERROR", 
    "detail": "An internal system error occurred while processing the request. Please do not retry this request." 
    } 
    
  • Issue with the request (status code 400):

    • Value was missing for a required field:

      { 
        "type": "BAD_REQUEST", 
        "detail": "A value was missing for a required field. Please provide the value." 
      } 
      
    • Uploaded file is too big:

      { 
        "type": "BAD_REQUEST", 
        "detail": "The uploaded file is too big. The allowed maximum size is 5MB." 
      }
      
    • User trying to upload multiple files at a time:

      { 
        "type": "BAD_REQUEST", 
        "detail": "Multiple file upload is not supported. Please try again with only one file." 
      } 
      
    • The uploaded file type is not supported:

      { 
        "type": "BAD_REQUEST", 
        "detail": "The uploaded file type is not supported." 
      }
      
    • File is not available for download because the scan is pending:

      { 
        "type": "NOT_FOUND", 
        "detail": "File with ID 7eb23368-48e2-486d-ace6-5819164803ab is not ready for download yet. Please try again later." 
      } 
      
    • File is not available for download because the scan failed or the file is in quarantine:

      { 
        "type": "NOT_FOUND", 
        "detail": "File with ID 7eb23368-48e2-486d-ace6-5819164803ab is not compliant." 
      }
      
  • User is unauthorized:

    { 
      "type": "UNAUTHORIZED", 
      "detail": "The user is not authorized to perform this action." 
    }
    
  • Requested resource is forbidden (status code 403):

    • User is forbidden:

      { 
        "type": "UNAUTHORIZED", 
        "detail": "The user is not authorized to perform this action." 
      }
      
    • User is not authorized to perform action:

      { 
        "type": "FORBIDDEN", 
        "detail": "The user is not authorized to perform this action." 
      } 
      
    • User is not authorized to access file:

      { 
        "type": "FORBIDDEN", 
        "detail": "The user is not authorized to access this file." 
      } 
      
  • Resource not found (status code 404):

    • File ID is invalid:

      { 
        "type": "NOT_FOUND", 
        "detail": "The provided file ID is invalid. Please provide a valid ID." 
      }
      
    • Invalid message id:

      { 
        "type": "NOT_FOUND", 
        "detail": "The provided message ID is invalid. Please provide a valid ID." 
      } 
      
    • Missing value in request:

      { 
        "type": "BAD_REQUEST", 
        "detail": "A value was missing for a required field. Please provide the value." 
      }