Adding file to an orderline¶
To add a file to an orderline, send a POST
request to /api/orderlines/{orderlineId}/files
.
The body needs to contain JSON data with file url. For example:
1 2 3 4 5 6 7 { "files": [ { "url": "https://www.test.nl/file.pdf" } ] }
The response, if successfully will be a JSON object with the following data:
1
"File upload is scheduled"
You can add file to an orderline which does not contain any file and you will be able to add only one file at this moment.
If you can no longer add file to an orderline, you will receive a 500 Internal Server Error
Example request¶
The following PHP code can be used to add a file to an orderline.
Make sure you replace the values YOUR_USER_ID_HERE
and YOUR_SECRET_HERE
with the User-ID and secret you received on the API-credentials page.
Make sure to replace ORDERLINEID
with the id of the orderline you would like to add file,
and URL
with the file url.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | <?php $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => "https://api.printdeal.com/api/orderlines/ORDERLINEID/files", CURLOPT_RETURNTRANSFER => true, CURLOPT_CUSTOMREQUEST => "POST", CURLOPT_POSTFIELDS => "{ 'files': [ { 'url': 'URL' } ] }", CURLOPT_HTTPHEADER => array( "User-ID: YOUR_USER_ID_HERE", "API-Secret: YOUR_SECRET_HERE" ) )); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } else { echo $response; } |