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 "Content-Type": "multipart/form-data" 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>> <code>(*)</code> it means the field is required.
> <code>(*?)</code> it means the field is conditionally required.</p>
<p>> + Allow file types: html, htm, pdf, tiff, tif, jpeg, png, docx, doc, xls, xlsx, zip, eml, txt
> + 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]=@&quot;/Users/wsy/Downloads/68d6392afc45934910b80a513db7b33c.jpeg&quot;' \
--form 'file_list[0][type]=&quot;Telex&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]=&quot;https://www.baidu.com/&quot;' \
--form 'urls[0][type]=&quot;DO&quot;'
Response:
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
{
&quot;data&quot;: [
{
&quot;id&quot;: 1046,
&quot;type&quot;: &quot;Telex&quot;,
&quot;is_customer_upload&quot;: true,
&quot;url&quot;: &quot;https://api.drayeasy.com/api/v2/orders/13001/files/1046&quot;,
&quot;filename&quot;: &quot;68d6392afc45934910b80a513db7b33c.jpeg&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>