lol and i am still stuck at upload API, got everything else to work fine no issues. Glad someone got upload API working... Do you mind helping me out on this upload CURL API ? I have tried every possibility and looked up curl file upload API's etc but no luck so far. I had given up on it lol.
Some curl examples of using this API:
parameters
access_token=ha93FNTGZyfyr5G5ymrFQ7Az8V4SntcEDlHi9BZ9aeHBjoHSK8xBg8ap4fhsIu6lPODZqD8BRQdbeU4Z3CAjKLIP10hJuo5kcJjDmseeirpwmuwp67JQTsFUsWEXkKix
account_id=19
folder_id=3
upload_file=fileToUpload.zip
------------------------------ cURL
curl -X POST \
http://www.1droid.com.au/api/v2/file/upload \
-H 'Cache-Control: no-cache' \
-H 'Content-Type: application/x-www-form-urlencoded' \
-H 'Postman-Token: 44304e29-f433-42d8-9a0c-36190f5c1ab7' \
-H 'content-type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW' \
-F access_token=ha93FNTGZyfyr5G5ymrFQ7Az8V4SntcEDlHi9BZ9aeHBjoHSK8xBg8ap4fhsIu6lPODZqD8BRQdbeU4Z3CAjKLIP10hJuo5kcJjDmseeirpwmuwp67JQTsFUsWEXkKix \
-F account_id=19 \
-F folder_id=3 \
-F upload_file=fileToUpload.zip
------------------------- C(LibCurl)
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "
http://www.1droid.com.au/api/v2/file/upload");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "Postman-Token: dbaf5410-8586-45b1-bfee-f5a75a65c734");
headers = curl_slist_append(headers, "Cache-Control: no-cache");
headers = curl_slist_append(headers, "Content-Type: application/x-www-form-urlencoded");
headers = curl_slist_append(headers, "content-type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "------WebKitFormBoundary7MA4YWxkTrZu0gW\r\nContent-Disposition: form-data; name=\"access_token\"\r\n\r\nha93FNTGZyfyr5G5ymrFQ7Az8V4SntcEDlHi9BZ9aeHBjoHSK8xBg8ap4fhsIu6lPODZqD8BRQdbeU4Z3CAjKLIP10hJuo5kcJjDmseeirpwmuwp67JQTsFUsWEXkKix\r\n------WebKitFormBoundary7MA4YWxkTrZu0gW\r\nContent-Disposition: form-data; name=\"account_id\"\r\n\r\n19\r\n------WebKitFormBoundary7MA4YWxkTrZu0gW\r\nContent-Disposition: form-data; name=\"folder_id\"\r\n\r\n3\r\n------WebKitFormBoundary7MA4YWxkTrZu0gW\r\nContent-Disposition: form-data; name=\"upload_file\"\r\n\r\nfileToUpload.zip\r\n------WebKitFormBoundary7MA4YWxkTrZu0gW--");
CURLcode ret = curl_easy_perform(hnd);
--------------------- PHP Curl
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "
http://www.1droid.com.au/api/v2/file/upload",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "------WebKitFormBoundary7MA4YWxkTrZu0gW\r\nContent-Disposition: form-data; name=\"access_token\"\r\n\r\nha93FNTGZyfyr5G5ymrFQ7Az8V4SntcEDlHi9BZ9aeHBjoHSK8xBg8ap4fhsIu6lPODZqD8BRQdbeU4Z3CAjKLIP10hJuo5kcJjDmseeirpwmuwp67JQTsFUsWEXkKix\r\n------WebKitFormBoundary7MA4YWxkTrZu0gW\r\nContent-Disposition: form-data; name=\"account_id\"\r\n\r\n19\r\n------WebKitFormBoundary7MA4YWxkTrZu0gW\r\nContent-Disposition: form-data; name=\"folder_id\"\r\n\r\n3\r\n------WebKitFormBoundary7MA4YWxkTrZu0gW\r\nContent-Disposition: form-data; name=\"upload_file\"\r\n\r\nfileToUpload.zip\r\n------WebKitFormBoundary7MA4YWxkTrZu0gW--",
CURLOPT_HTTPHEADER => array(
"Cache-Control: no-cache",
"Content-Type: application/x-www-form-urlencoded",
"Postman-Token: a355176e-3b67-4702-ac80-99fefff62a77",
"content-type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW"
),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
---------------------------- HTTP
POST /api/v2/file/upload HTTP/1.1
Host:
www.1droid.com.au
Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW
Cache-Control: no-cache
Postman-Token: 42a2014b-bee5-48f2-baea-2e73ae048a05
------WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="access_token"
ha93FNTGZyfyr5G5ymrFQ7Az8V4SntcEDlHi9BZ9aeHBjoHSK8xBg8ap4fhsIu6lPODZqD8BRQdbeU4Z3CAjKLIP10hJuo5kcJjDmseeirpwmuwp67JQTsFUsWEXkKix
------WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="account_id"
19
------WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="folder_id"
3
------WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="upload_file"
fileToUpload.zip
------WebKitFormBoundary7MA4YWxkTrZu0gW--