Hi Experts -
I am new into REST API development. We are looking to integrate with Tradeshift using REST API.
I am able to connect to Sandbox server and able to get the GET the document or invoice created manually.
Now we need to create new document or invoice using POST Method but I am getting 415 Unsupported Media Type.
URL used while POST -
https://api-sandbox.tradeshift.com/tradeshift/rest/external/documents/dispatcher
Documentation says -
Send Document
Description
Store and dispatch the document - the actual document content must be sent as the entity/body of the POST call.
documentId
- REQUIRED
A client-generated id for the new document to be dispatched
- IN: QUERY
- TYPE: STRING
documentProfileId
- REQUIRED
The document profile id that the document adheres to (e.g. "nes.p5.invoice.ubl.2.1.dk"), from the ‘documentprofiles’ resource
- IN: QUERY
- TYPE: STRING
documentSource
Track the document’s source - We save the source of the document in a new table called documentsource so that we know where the document was dispatched from.
- IN: QUERY
- TYPE: STRING
JSON Received by GET METHOD
{
“itemsPerPage”: 25,
“itemCount”: 1,
“indexing”: false,
“numPages”: 1,
“pageId”: 0,
“Document”: [
{
“DocumentId”: “57294446-39e0-47ae-b695-cf56fc3d9e8c”,
“ID”: “INV1133”,
“URI”: “https://api-sandbox.tradeshift.com/tradeshift/rest/external/documents/57294446-39e0-47ae-b695-cf56fc3d9e8c”,
“DocumentType”: {
“mimeType”: “text/xml”,
“documentProfileId”: “nes.p5.invoice.ubl.2.1.gb”,
“type”: “invoice”
},
“State”: “PROCESSING”,
“CreatedDateTime”: “2023-06-13T10:39:45.944Z”,
“LastEdit”: “2023-06-13T10:40:36.553Z”,
“Actor”: {
“Created”: “2023-06-13T10:26:55.688Z”,
“Modified”: “2023-06-13T10:26:55.688Z”,
“FirstName”: “Gurjeet”,
“LastName”: “Singh”,
“Email”: “gurjeet.Singh@gmail.com”,
“MobileNumberVerified”: false
},
“ConversationId”: “c173cf9f-d6a7-437c-b9af-7bfb51bbfbbd”,
“ReceiverCompanyName”: “ABC”,
“Tags”: {
“Tag”:
},
“ItemInfos”: [
{
“type”: “document.description”,
“value”: “description field for 1 week”
},
{
“type”: “document.total”,
“value”: “223.00”
},
{
“type”: “document.currency”,
“value”: “GBP”
},
{
“type”: “document.issuedate”,
“value”: “2023-06-13”
},
{
“type”: “invoice.due”,
“value”: “2023-06-17”
}
],
“LatestDispatch”: {
“DispatchId”: “42cb64ca-9edf-4a15-9f46-9900a04e42c4”,
“ObjectId”: “57294446-39e0-47ae-b695-cf56fc3d9e8c”,
“Created”: “2023-06-13T10:40:36.515Z”,
“SenderUserId”: “d94bddf1-6657-4bfd-8226-fd58d08d4e8a”,
“DispatchState”: “ACCEPTED”,
“LastStateChange”: “2023-06-13T10:40:36.515Z”
},
“SentReceivedTimestamp”: “2023-06-13T10:40:36.049Z”,
“ProcessState”: “PENDING”,
“ConversationStates”: [
{
“Axis”: “PROCESS”,
“State”: “PENDING”,
“Timestamp”: “2023-06-13T10:40:36.049Z”
},
{
“Axis”: “DELIVERY”,
“State”: “PENDING_CONNECTION”,
“Timestamp”: “2023-06-13T10:40:36.049Z”
}
],
“UnifiedState”: “PENDING_NOT_A_CONTACT”,
“CopyIndicator”: false,
“Deleted”: false,
“DueDate”: “2023-06-17”,
“TenantId”: “27762e54-2f16-4895-8c60-f2ea88c9ef75”,
“Properties”: [
{
“scheme”: “documentSource”,
“value”: “UI”
}
]
}
]
}