DrayEasy API v2

DrayEasy API v2


Upload Files to Order

<h2>Overview</h2> <p>This endpoint allows you to upload files or provide URLs associated with a specific order identified by <code>{orderId}</code>. The request should include either an array of files (<code>files</code>) or an array of URLs (<code>urls</code>). Both <code>files</code> and <code>urls</code> are conditionally required, meaning you must provide one of them but not necessarily both.</p> <h2>Request</h2> <ul> <li>Method: <strong>POST</strong></li> <li>URI: <code>/orders/{orderId}/files</code></li> </ul> <table> <thead> <tr> <th>Name</th> <th>Type</th> <th>Description</th> </tr> </thead> <tbody> <tr> <td><del>files</del></td> <td>Array</td> <td>The files field is <code>deprecated</code> and should not be used. It was previously used as an array of files, with a maximum size of 10MB. If applicable, include the header 'Content-Type': 'multipart/form-data'</td> </tr> <tr> <td>file_list (*)</td> <td>Array</td> <td>File list is a two-dimensional array, each element contains file and type, where file is required and type is optional.</td> </tr> <tr> <td>file_list[file]</td> <td>File</td> <td>File, Max Size 10M. Please add Header &quot;Content-Type&quot;: &quot;multipart/form-data&quot; if applicable</td> </tr> <tr> <td>file_list[type]</td> <td>Enum</td> <td>Type should be one of the following: DO, DG form, Packing List, MBL, Telex, PU#, SOC Return Guarantee Letter, Arrival Notice, or Other.</td> </tr> <tr> <td>urls (*?)</td> <td>Array</td> <td>Urls is a two-dimensional array, each element contains url and type, where url is required and type is optional.</td> </tr> <tr> <td>urls[url]</td> <td>String</td> <td>Avaliable url</td> </tr> <tr> <td>urls[type]</td> <td>Enum</td> <td>Type should be one of the following: DO, DG form, Packing List, MBL, Telex, PU#, SOC Return Guarantee Letter, Arrival Notice, or Other.</td> </tr> </tbody> </table> <p>&gt; <code>(*)</code> it means the field is required. &gt; <code>(*?)</code> it means the field is conditionally required.</p> <p>&gt; + Allow file types: html, htm, pdf, tiff, tif, jpeg, png, docx, doc, xls, xlsx, zip, eml, txt &gt; + Max file size: 10mb</p> <h2>Code Example</h2> <pre><code>Request: curl --location 'https://api.drayeasy.com/api/v2/orders/6129/files' \ --header 'Content-Type: multipart/form-data' \ --header 'Authorization: Bearer xxxxxxxxx' \ --form 'file_list[0][file]=@&amp;quot;/Users/wsy/Downloads/68d6392afc45934910b80a513db7b33c.jpeg&amp;quot;' \ --form 'file_list[0][type]=&amp;quot;Telex&amp;quot;' curl --location 'https://api.drayeasy.com/api/v2/orders/6129/files' \ --header 'Accept: application/json' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer xxxxxxxxx' \ --form 'urls[0][url]=&amp;quot;https://www.baidu.com/&amp;quot;' \ --form 'urls[0][type]=&amp;quot;DO&amp;quot;' Response: HTTP/1.1 200 OK Content-Type: application/json; charset=utf-8 { &amp;quot;data&amp;quot;: [ { &amp;quot;id&amp;quot;: 1046, &amp;quot;type&amp;quot;: &amp;quot;Telex&amp;quot;, &amp;quot;is_customer_upload&amp;quot;: true, &amp;quot;url&amp;quot;: &amp;quot;https://api.drayeasy.com/api/v2/orders/13001/files/1046&amp;quot;, &amp;quot;filename&amp;quot;: &amp;quot;68d6392afc45934910b80a513db7b33c.jpeg&amp;quot; } ] }</code></pre> <h2>Response Fields Description</h2> <table> <thead> <tr> <th>Name</th> <th>Type</th> <th>Description</th> </tr> </thead> <tbody> <tr> <td>data</td> <td>Array</td> <td>Array of uploaded file information</td> </tr> <tr> <td>data[id]</td> <td>Integer</td> <td>ID of the uploaded file</td> </tr> <tr> <td>data[type]</td> <td>String</td> <td>Type of the uploaded file</td> </tr> <tr> <td>data[url]</td> <td>String</td> <td>URL to access the uploaded file</td> </tr> <tr> <td>data[filename]</td> <td>String</td> <td>Name of the uploaded file</td> </tr> </tbody> </table>

页面列表

ITEM_HTML