Scout RFP (Workday Strategic Sourcing) attachments API
Use the attachments API to create, update, and delete the attachments in Workday Strategic Sourcing. ## Working with Attachments Creating attachments for Workday Strategic Sourcing objects is a two-step process. First, you need to inform the system about your intention to upload an attachment by issuing a "Create an Attachment" request, consisting of the file name and a link to the object to which you are adding an attachment. The link is represented by a relationship object containing an object ID and its type. In the response you will receive a link in the `upload_url` attributes, along with required HTTP headers to send with your file. You will need to upload your file as a binary stream in a PUT request into the specified URL, making sure the required headers are present. Here is how the workflow might look like when triggered from a console: ```bash $ curl -H "X-Api-Key: ${COMPANY_KEY}" \ -H "X-User-Token: ${USER_TOKEN}" \ -H "X-User-Email: ${USER_EMAIL}" \ -H "Content-Type: application/vnd.api+json" \ -X POST \ -d ' { "data": { "type": "attachments", "attributes": { "title": "My Interesting Document", "file_name": "Some Interesting File.pdf" }, "relationships": { "contract": { "data": { "id": 1, "type": "contracts" } } } } } ' \ "https://api.us.workdayspend.com/services/attachments/v1/attachments" { "data": { "id": "1", "type": "attachments", "attributes": { "title": "My Interesting Document", "file_size": null, "upload_url": "https://upload.s3.amazonaws.com/uploads/contract/1/hex/file.pdf?some=very&long=url", "upload_headers": [ { "name": "Content-Type", "value": "application/octet-stream" }, { "name": "x-amz-acl", "value": "private" }, { "name": "x-amz-server-side-encryption", "value": "AES256" }, { "name": "Content-Disposition", "value": "attachment" } ] } } } $ curl -X PUT \ --data "@file.pdf" \ -H "Content-Type: application/octet-stream" \ -H "x-amz-acl: private" \ -H "x-amz-server-side-encryption: AES256" \ -H "Content-Disposition: attachment" \ https://upload.s3.amazonaws.com/uploads/contract/1/hex/file.pdf?some=very&long=url ``` The upload URL expires within 15 minutes after issuing. Please note that you will not be able to upload the data file to the attachment object after that. An automated system will purge all partial uploads after a certain period (usually within 30-60 minutes after creation) to prevent orphan records from overflowing the system. **Please Note**: The list of headers and their values might change at any time, so when you're implementing an integration with the Workday Strategic Sourcing system, make sure to include all of the HTTP headers returned from the attachments endpoint. ## Attachment Object