{"id":2692,"date":"2021-03-05T12:57:36","date_gmt":"2021-03-05T11:57:36","guid":{"rendered":"https:\/\/www.trans.eu\/api\/?p=2692"},"modified":"2025-12-29T11:00:34","modified_gmt":"2025-12-29T10:00:34","slug":"add-attachement-to-order","status":"publish","type":"post","link":"https:\/\/www.trans.eu\/api\/orders\/order-attachments\/add-attachement-to-order\/","title":{"rendered":"Order attachments"},"content":{"rendered":"\n<p>After cre\u00adat\u00ading an order you can add an attach\u00adment to it (option avail\u00adable for not can\u00adcelled orders only).<br>Adding an attach\u00adment takes two steps \u2014 <a href=\"https:\/\/www.trans.eu\/api\/attachments\/uploading-and-downloading-attachments\/\">upload\u00ading a file<\/a> and adding it to a spe\u00adcif\u00adic order.<br>You can also <a href=\"https:\/\/www.trans.eu\/api\/attachments\/uploading-and-downloading-attachments\/\">down\u00adload a file<\/a> attached to an order.<\/p>\n\n\n\n<!--more-->\n\n\n\n<h2 class=\"wp-block-heading\">Authorization and access<\/h2>\n\n\n\n<p>Autho\u00adriza\u00adtion process is described <a href=\"https:\/\/www.trans.eu\/api\/general-information\/authorization-process\/\" target=\"_blank\" rel=\"noopener\" title>here<\/a>. Each API request must also con\u00adsist of unique Api-key obtained dur\u00ading appli\u00adca\u00adtion reg\u00adis\u00adtra\u00adtion togeth\u00ader with client_id and client_secret.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Adding file to an order url parameters<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>URL: <\/strong>https:\/\/api.platform.trans.eu<\/li>\n\n\n\n<li><strong>End\u00adpoint:<\/strong> \/orders-api\/v1\/orders\/{orderId}\/attachments<\/li>\n\n\n\n<li><strong>Http Method:<\/strong> POST<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">Description of fields:<\/h3>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td><strong>Name<\/strong><\/td><td><strong>Type<\/strong><\/td><td><strong>Exam\u00adple<\/strong><\/td><td><strong>Descrip\u00adtion<\/strong><\/td><\/tr><tr><td><div><div>media_id<\/div><\/div><\/td><td>string<\/td><td><span style=\"font-weight: 400;\">eb6bd829-0794\u20134553-8d8f-7f000ea76d15<\/span><\/td><td>Id of pre\u00advi\u00adous\u00adly uploaded file<\/td><\/tr><tr><td><div><span style=\"font-family: inherit; font-size: inherit; font-weight: inherit; color: initial;\">media_name<\/span> <span style=\"font-family: inherit; font-size: inherit; font-weight: inherit; color: initial;\"> <\/span><\/div><\/td><td>string<\/td><td>Media name<\/td><td>File name<\/td><\/tr><tr><td><div><div>descrip\u00adtion<\/div><\/div><\/td><td>string<\/td><td>Doc\u00adu\u00admen\u00adta\u00adtion<\/td><td>File descrip\u00adtion (max\u00adi\u00admum 200 char\u00adac\u00adters)<\/td><\/tr><tr><td><div><span style=\"font-family: inherit; font-size: inherit; font-weight: inherit; color: initial;\">type_id<\/span> <\/div><\/td><td>string<\/td><td>Way\u00adbill<\/td><td>One of the fol\u00adlow\u00ading: way\u00adbill, transport_order, cession_scan, cargo_photo, invoice_scan, cmr, oth\u00ader<\/td><\/tr><tr><td>visible_to_contractor<\/td><td>Boolean<\/td><td>True<\/td><td>Defines if file should be vis\u00adi\u00adble to con\u00adtrac\u00adtor<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Json example<\/h2>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-json\" data-lang=\"JSON\"><code>{\n  \"media_id\": \"eb6bd829-0794-4553-8d8f-7f000ea76d15\",\n  \"media_name\": \"Media name\",\n  \"description\": \"Documentation\",\n  \"type_id\": \"Waybill\",\n  \"visible_to_contractor\": true\n}<\/code><\/pre><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">Json response example<\/h2>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-json\" data-lang=\"JSON\"><code>{}<\/code><\/pre><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">Downloading file from an order<\/h2>\n\n\n\n<p>In order to down\u00adload an attach\u00adment you have to give media_id which you\u2019ll find in attach\u00adments object.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Delete attachement of an order<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>URL: <\/strong>https:\/\/api.platform.trans.eu<\/li>\n\n\n\n<li><strong>End\u00adpoint:<\/strong> \/orders-api\/v1\/orders\/:orderId\/attachments\/:attachmentId<\/li>\n\n\n\n<li><strong>Http Method:<\/strong> DELETE<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">Response<\/h3>\n\n\n\n<p>Response for prop\u00ader\u00adly giv\u00aden freight id is Http code 204 with no response con\u00adtent.<\/p>\n","protected":false},"excerpt":{"rendered":"<p class=\"dont-break-out\">After cre\u00adat\u00ading an order you can add an attach\u00adment to it (option avail\u00adable for not can\u00adcelled orders only).Adding an attach\u00adment \u2026<\/p>\n","protected":false},"author":12,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"wp_typography_post_enhancements_disabled":false,"footnotes":""},"categories":[104],"tags":[],"class_list":["post-2692","post","type-post","status-publish","format-standard","hentry","category-order-attachments"],"acf":[],"aioseo_notices":[],"lang":"en","translations":{"en":2692},"pll_sync_post":[],"_links":{"self":[{"href":"https:\/\/www.trans.eu\/api\/wp-json\/wp\/v2\/posts\/2692","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.trans.eu\/api\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.trans.eu\/api\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.trans.eu\/api\/wp-json\/wp\/v2\/users\/12"}],"replies":[{"embeddable":true,"href":"https:\/\/www.trans.eu\/api\/wp-json\/wp\/v2\/comments?post=2692"}],"version-history":[{"count":1,"href":"https:\/\/www.trans.eu\/api\/wp-json\/wp\/v2\/posts\/2692\/revisions"}],"predecessor-version":[{"id":5522,"href":"https:\/\/www.trans.eu\/api\/wp-json\/wp\/v2\/posts\/2692\/revisions\/5522"}],"wp:attachment":[{"href":"https:\/\/www.trans.eu\/api\/wp-json\/wp\/v2\/media?parent=2692"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.trans.eu\/api\/wp-json\/wp\/v2\/categories?post=2692"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.trans.eu\/api\/wp-json\/wp\/v2\/tags?post=2692"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}