Parsaspace

Parsaspace Documentation!

Welcome to the parsaspace Cloud Services Documentation. Whether you are new to parsaspace or an advanced user, you can find useful information about the services ranging from introductions to advanced features.

About Parsaspace

Parsaspace has a simple web services interface that you can use to store and retrieve any amount of data, at any time, from anywhere on the web. It gives any developer access to the same highly scalable, reliable, fast, inexpensive data storage infrastructure that Parsaspace uses to run its own global network of web sites. The service aims to maximize benefits of scale and to pass those benefits on to developers. This guide explains the core concepts of parsaspace, and how to work with these resources using the Parsaspace application programming interface (API).

End Points

These endpoints accept arguments as JSON or xml in the request body and return results as JSON or xml in the response body. RPC endpoints are on the api.parsaspace.com domain.

Url:

api.parsaspace.com/v1/

Endpoint Reference:

Method Endpoint Return
post /v1/files/list File List
post /v1/files/remove Remove Files
post /v1/files/rename Rename Files
post /v1/files/move Move Files
post /v1/files/copy Copy Files
post /v1/files/createfolder Create Folder
post /v1/files/upload Upload Files
Authorization

Parsaspace supports OAuth 2.0 for authorizing API requests. Find out more in our OAuth guide. Authorized requests to the API should use an Authorization header with the value Bearer<TOKEN>where <TOKEN> is an access token obtained through the OAuth flow.

Everything (methods,parameters,etc.) is fixed to a version number, and every call must contain one.

User Authentication:

This is the most common authentication type. This type uses an access token for a specific user and app pair, in order to operate on that user's account, to the extent allowed by that app's permission.

Your Token Type:

Bearer

Example:

curl -X POST "https://api.parsaspace.com/v1" \
--header "Authorization: Bearer <OAUTH2_ACCESS_TOKEN>"

Error 401

401 error or "Authorization has been denied for this request." This error occurs when the token has entered wrong, the duration of the token is over and you should get a new token. This also could happen if current user is deactivated or its password has changed.

Request

Requests can be send with any payload formatted in JSON or xml. All requests must include both Authorization in headers and Domain in body or Headers.

Required Parameters:


Name Entry In Example Description
Authorization Headers Bearer <your token> Your token generated on your profile page
Domain Body/Headers yourdomain yourdomain associated with your account
Responses

Format:

Each response is a JSON or xml object. The data requested is wrapped in the RESULT tag. If you have a response, it will always be within the RESULT field. We also include a SUCCESS flag, an array of potential ERRORS, and MESSAGES in the response. Some responses can have additional pagination info wrapped in the RESULT_INFO.

Success Response:

{  "result": "success"} 

Error Response:

{"result":"error","message":"not implemented"}
Error Handeling

Errors are returned using standard HTTP error code syntax. Any additional info is included in the body of the return call, JSON-formatted. Error codes not listed here are in the API methods listed below.

Status Code:


Code Result Description Message
200 if it's success When the operation is successful, we have a page count output that Specifies the number of all recoreds you have. The request was successfull in some form
400 error Bad input parameter. Error message should indicate which one and why. bad request" "Your browser sent a request that this server could not understand
403 error Bad OAuth request (wrong consumer key, bad nonce, expired timestamp...). Unfortunately, re-authenticating the user won't help here. Sorry!Access denied
File List

Return the list of all shared folders or files the current user has access to.

Url:

api.parsaspace.com/v1/files/list

Method:

Post

Authentication:

User Authentication

Parameter Enty In Type Description Required
Authorization Headers Bearer <your token>     Your token generated on your profile page required
domain Body String domain specifies the file list. required
path Body String The user must specify the file path, system automatically considers the root path. optional
type Body String it can be json or xml, system automatically consider the json type. optional

Sample Response:

{"result":"success","list":[{"Name":"a.txt","IsFolder":false,"Size":8,"LastModified":"2016-11-07 09:49:24"},{"Name":"b.txt","IsFolder":false,"Size":3,"LastModified":"2016-11-07 09:49:24"}]}

Sample Code:

$curl = curl_init();
curl_setopt_array($curl,
array(
CURLOPT_URL => "http://api.parsaspace.com/v1/files/list",
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST =>"POST",
CURLOPT_RETURNTRANSFER=>true,
CURLOPT_POSTFIELDS =>"path=Your-path&domain=Your-Domain&type=json",
CURLOPT_HTTPHEADER => array(
"authorization: Your-Token",
),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err){
echo "cURL Error #:" $err;
}
else {
echo $response;
}
HttpResponse response = Unirest.post("http://api.parsaspace.com/v1/files/list")
.header("authorization", "Your-token")
.body("path=Your-Path &domain=Your-Doamin&type=json")
.asString();

var client = new RestClient("http://api.parsaspace.com/v1/files/list");
var request = new RestRequest(Method.POST);
request.AddHeader("authorization", "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1bmlxdWVfbmFtZSI6InNhZWlkbWFyb3VmaTY2QGd");
request.AddHeader("content-type", "application/x-www-form-urlencoded");
IRestResponse response = client.Execute(request);

import requests
url = "http://api.parsaspace.com/v1/files/list"
payload = "path=Your-Path &domain=Your-Domain &type=json"
headers = {
'authorization': "Your-Token",
}
response = requests.request("POST", url, data=payload, headers=headers)
print(response.text)

var request = require("request");
var options = { method: 'POST',
url:'http://api.parsaspace.com/v1/files/list',
headers:
{
authorization: '' },
form: { path: '/', domain: 'yourdomain', type: 'json' } };
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});

Error Example:

{
"result": "success",
"list":[{"List of files"}];
}

{
"result": "error",.
"message": "access denied"
}

{
"result": "error",
"message": Object already exist.",
}

{
"result": "error",
"message": "Authorization has been denied for this request.",
}

{
"result": "error",
"message": Sorry!Access denied",
}

Remove

Remove all custom properties from a specified template associated with a file.

Url:

api.parsaspace.com/v1/files/remove

Method:

Post

Authentication:

User Authentication

Parameter Enty In Type Description Required
Authorization Headers Bearer <your token>     Your token generated on your profile page required
domain Body String domain specifies the file list. required
path Body String User can remove one or more files and must specify files path to remove them and best pattern to separate paths is (,)
system automatically considers the root path.
example: /images/a.txt,/music/1.mp3
optional
type Body String it can be json or xml, system automatically consider the json type.
example:/c
optional

Sample Response:

{  "result": "success"}

Sample Code:


$curl = curl_init();

curl_setopt_array($curl, array(
CURLOPT_URL => "http://api.parsaspace.com/v1/files/remove",
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_RETURNTRANSFER=>true,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "path=%2Ftest-4&domain=yourdomain&type=json",
CURLOPT_HTTPHEADER => array(
"authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1bmlxdWVfbmFtZSI6InNhZWlkbWFyb3VmaTY2QGd",
"cache-control: no-cache",
"content-type: application/x-www-form-urlencoded",
),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
HttpResponse response = Unirest.post("http://api.parsaspace.com/v1/files/remove")
.header("content-type", "application/x-www-form-urlencoded")
.header("authorization", "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1bmlxdWVfbmFtZSI6InNhZWlkbWFyb3VmaTY2QGd")
.body("path=%2Ftest-4&yourdomain&type=json")
.asString();
var client = new RestClient("http://api.parsaspace.com/v1/files/remove");
var request = new RestRequest(Method.POST);
request.AddHeader("authorization", Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1bmlxdWVfbmFtZSI6InNhZWlkbWFyb3VmaTY2QGd");
request.AddHeader("content-type", "application/x-www-form-urlencoded");IRestResponse response = client.Execute(request);
import requests
url = "http://api.parsaspace.com/v1/files/remove"
payload = "path=%2Ftest-4&domain=yourdomain&type=json"
headers = {
'content-type': "application/x-www-form-urlencoded",
'authorization': "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1bmlxdWVfbmFtZSI6InNhZWlkbWFyb3VmaTY2QGd",
}
esponse = requests.request("POST", url, data=payload, headers=headers)
print(response.text)
var request = require("request");
var options = { method: 'POST',
url: 'http://api.parsaspace.com/v1/files/remove',
headers:
{
authorization: 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1bmlxdWVfbmFtZSI6InNhZWlkbWFyb3VmaTY2QGd' },
form: { path: '/test-4', domain: 'yourdomain', type: 'json' } };

request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});

Error Example:

{
"result": "success",
}

{
"result": "error",
"message": "Object already exist.",
}

{
"result": "error",
"message": "Sorry!Access denied",
}

Rename

Rename every custom properties from a specified template associated with a file.

Url:

api.parsaspace.com/v1/files/rename

Method:

Post

Authentication:

User Authentication

Parameter Entry In Type Description Required
Authorization Headers Bearer <your token>     Your token generated on your profile page required
domain Body String domain specifies the file list. required
type Body String it can be json or xml, system automatically consider the json type. optional
source Body String the primary path of the file which want to rename.
example: api.parsaspace.com/v1/files/rename/image/a.text
required
destination Body String the final path of the file which want to rename. required

Sample Response:

{"result":"success"}

Sample Code:


$curl = curl_init();

curl_setopt_array($curl, array(
CURLOPT_URL => "http://api.parsaspace.com/v1/files/rename",
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_RETURNTRANSFER=>true,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "source=%2Ftest-1&destination=%2Ftest-4&domain=yourdomain&type=json",
CURLOPT_HTTPHEADER => array(
"authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1bmlxdWVfbmFtZSI6InNhZWlkbWFyb3VmaTY2QGd",
"cache-control: no-cache",
"content-type: application/x-www-form-urlencoded",
),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
HttpResponse response = Unirest.post("http://api.parsaspace.com/v1/files/rename")
.header("content-type", "application/x-www-form-urlencoded")
.header("authorization", "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1bmlxdWVfbmFtZSI6InNhZWlkbWFyb3VmaTY2QGd")
.body("source=%2Ftest-1&destination=%2Ftest-4&domain=yourdomain&type=json")
.asString();
var client = new RestClient("http://api.parsaspace.com/v1/files/rename");
var request = new RestRequest(Method.POST);
request.AddHeader("authorization","Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1bmlxdWVfbmFtZSI6InNhZWlkbWFyb3VmaTY2QGd");
request.AddHeader("content-type", "application/x-www-form-urlencoded");
IRestResponse response = client.Execute(request);
import requests
url = "http://api.parsaspace.com/v1/files/rename"

payload = "source=%2Ftest-1&destination=%2Ftest-4&domain=yourdomain&type=json"
headers = {
'content-type': "application/x-www-form-urlencoded",
'authorization': "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1bmlxdWVfbmFtZSI6InNhZWlkbWFyb3VmaTY2QGd",
}

esponse = requests.request("POST", url, data=payload, headers=headers)

print(response.text)
var request = require("request");
var options = { method: 'POST',
url: 'http://api.parsaspace.com/v1/files/rename',
headers:
{
authorization: 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1bmlxdWVfbmFtZSI6InNhZWlkbWFyb3VmaTY2QGd',
'content-type': 'application/x-www-form-urlencoded' },
form:
{ source: '/test-1',
destination: '/test-4',
domain: 'yourdomain',
type: 'json' } };
request(options, function (error, response, body) {
if (error) throw new Error(error);

console.log(body);
});

Error Example:

{
"result": "ok",
}


{
"result": "operation failed",
}

{
"result": "error",
"message": "Object already exist.",
}

{
"result": "error",
"message": "Sorry!Access denied",
}

Move

Move all custom properties from a specified template to an other specified folder.

Url:

api.parsaspace.com/v1/files/move

Method:

Post

Authentication:

User Authentication

Parameter Entry In Type Description Required
Authorization Headers Bearer <your token>     Your token generated on your profile page required
domain Body String Each user can have multiple file or website, domain specifies the file list. required
type Body String it can be json or xml, system automatically consider the json type. optional
source Body String User can move one or more files and must specify files primary path to move them and best pattern to separate the paths is (,).
example: /images/a.txt,/music/1.mp3
required
destination Body String the final path of the file which want to rename.
example:/c
required

Sample Response:

{  "result": "success"}

Sample Code:


$curl = curl_init();

curl_setopt_array($curl, array(
CURLOPT_URL => "http://api.parsaspace.com/v1/files/move",
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_RETURNTRANSFER=>true,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "source=%2Ftest-3&destination=%2Ftest-1%2Ftest-3&domain=yourdomain&type=json",
CURLOPT_HTTPHEADER => array(
"authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1bmlxdWVfbmFtZSI6InNhZWlkbWFyb3VmaTY2QGd",
"cache-control: no-cache",
"content-type: application/x-www-form-urlencoded",
),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
HttpResponse response = Unirest.post("http://api.parsaspace.com/v1/files/move")
.header("content-type", "application/x-www-form-urlencoded")
.header("authorization", "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1bmlxdWVfbmFtZSI6InNhZWlkbWFyb3VmaTY2QGd")
.body("source=%2Ftest-3&destination=%2Ftest-1%2Ftest-3&domain=yourdomain&type=json")
.asString();
var client = new RestClient("http://api.parsaspace.com/v1/files/move");
var request = new RestRequest(Method.POST);
request.AddHeader("authorization", "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1bmlxdWVfbmFtZSI6InNhZWlkbWFyb3VmaTY2QGd");
request.AddHeader("content-type", "application/x-www-form-urlencoded");
IRestResponse response = client.Execute(request);
import requests

url = "http://api.parsaspace.com/v1/files/move"

payload = "source=%2Ftest-3&destination=%2Ftest-1%2Ftest-3&domain=yourdomain.com&type=json"
headers = {
'content-type': "application/x-www-form-urlencoded",
'authorization': "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1bmlxdWVfbmFtZSI6InNhZWlkbWFyb3VmaTY2QGd",
}

esponse = requests.request("POST", url, data=payload, headers=headers)

print(response.text)
var request = require("request");

var options = { method: 'POST',
url: 'http://api.parsaspace.com/v1/files/move',
headers:
{ authorization: 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1bmlxdWVfbmFtZSI6InNhZWlkbWFyb3VmaTY2QGd',
'content-type': 'application/x-www-form-urlencoded' },
form:
{ source: '/test-3',
destination: '/test-1/test-3',
domain: 'yourdomain',
type: 'json' } };

request(options, function (error, response, body) {
if (error) throw new Error(error);

console.log(body);
});

Error Example:

{
"result": "success",
}

{
"result": "error",
"message": "Object already exist.",
}

{
"result": "error",
"message": "Sorry!Access denied",
}

Copy

Copy all custom properties from a specified template to an other specified folder.

Url:

api.parsaspace.com/v1/files/Copy

Method:

Post

Authentication:

User Authentication

Parameter Entry In Type Description Required
Authorization Headers Bearer <your token>     Your token generated on your profile page required
domain Body String Each user can have multiple file or website, domain specifies the file list. required
type Body String it can be json or xml, system automatically consider the json type. optional
source Body String User can copy one or more files and must specify files primary path to copy them and best pattern to separate the paths is (,).
example: /images/a.txt,/music/1.mp3
required
destination Body String the final path of the folder which want copy the file on it.
example:/c
required

Sample Response:

{  "result": "success"}

Sample Code:

$curl = curl_init();

curl_setopt_array($curl, array(
CURLOPT_URL => "http://api.parsaspace.com/v1/files/copy",

CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_RETURNTRANSFER=>true,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "domain=yourdomain&type=json&source=%2Fa&destination=%2Fb",
CURLOPT_HTTPHEADER => array(
"authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1bmlxdWVfbmFtZSI6InNhZWlkbWFyb3VmaTY2QGd",

"content-type: application/x-www-form-urlencoded",

),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}

HttpResponse response = Unirest.post("http://api.parsaspace.com/v1/files/copy")
.header("content-type", "application/x-www-form-urlencoded")
.header("authorization", "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1bmlxdWVfbmFtZSI6InNhZWlkbWFyb3VmaTY2QGd")
.body("yourdomain&type=json&source=%2Fa&destination=%2Fb")
.asString();

var client = new RestClient("http://api.parsaspace.com/v1/files/copy");
var request = new RestRequest(Method.POST);
request.AddHeader("authorization", "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1bmlxdWVfbmFtZSI6InNhZWlkbWFyb3VmaTY2QGd");
request.AddHeader("content-type", "application/x-www-form-urlencoded");
IRestResponse response = client.Execute(request);

import requests

url = "http://api.parsaspace.com/v1/files/copy"

payload = "yourdomain&type=json&source=%2Fa&destination=%2Fb"
headers = {
'content-type': "application/x-www-form-urlencoded",
'authorization': "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1bmlxdWVfbmFtZSI6InNhZWlkbWFyb3VmaTY2QGd",

}

response = requests.request("POST", url, data=payload, headers=headers)

print(response.text)

var request = require("request");

var options = { method: 'POST',
url: 'http://api.parsaspace.com/v1/files/copy',
headers:
{
authorization: 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1bmlxdWVfbmFtZSI6InNhZWlkbWFyb3VmaTY2QGd' },
form:
{ domain: 'yourdomain',
type: 'json',
source: '/a',
destination: '/b' } };

request(options, function (error, response, body) {
if (error) throw new Error(error);

console.log(body);
});

Error Example:

{
"result": "success",
}

{
"result": "error",
"message":"can not copy file",
}

{
"result": "error",
"message": "Object already exist.",
}

{
"result": "error",
"message": "Sorry!Access denied",
}

Create

Create a new file with the contents provided in the request!

Url:

api.parsaspace.com/v1/files/Createfolder

Method:

Post

Authentication:

User Authentication

Parameter Entry In Type Description Required
Authorization Headers Bearer <your token>     Your token generated on your profile page required
domain Body String domain specifies the file list. required
path Body String the user must specify the file path, system automatically considers the root path. optional
type Body String it can be json or xml, system automatically consider the json type. optional

Sample Response:

{"result":"success"}

Sample Code:


$curl = curl_init();

curl_setopt_array($curl, array(
CURLOPT_URL => "http://api.parsaspace.com/v1/files/createfolder",
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_RETURNTRANSFER=>true,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "path=%2Fhello&domain=yourdomain&type=json",
CURLOPT_HTTPHEADER => array(
"authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1bmlxdWVfbmFtZSI6InNhZWlkbWFyb3VmaTY2QGd",
"cache-control: no-cache",
"content-type: application/x-www-form-urlencoded",
),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
HttpResponse response = Unirest.post("http://api.parsaspace.com/v1/files/createfolder")
.header("content-type", "application/x-www-form-urlencoded")
.header("authorization", "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1bmlxdWVfbmFtZSI6InNhZWlkbWFyb3VmaTY2QGd")
.body("path=%2Fhello&yourdomain&type=json")
.asString();
var client = new RestClient("http://api.parsaspace.com/v1/files/createfolder");
var request = new RestRequest(Method.POST);
request.AddHeader("Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1bmlxdWVfbmFtZSI6InNhZWlkbWFyb3VmaTY2QGd");
request.AddHeader("content-type", "application/x-www-form-urlencoded");
IRestResponse response = client.Execute(request);
import requests

url = "http://api.parsaspace.com/v1/files/createfolder"

payload = "path=%2Fhello&yourdomain&type=json"
headers = {
'content-type': "application/x-www-form-urlencoded",
'authorization': "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1bmlxdWVfbmFtZSI6InNhZWlkbWFyb3VmaTY2QGd",
}

esponse = requests.request("POST", url, data=payload, headers=headers)

print(response.text)
var request = require("request");
var options = { method: 'POST',
url: 'http://api.parsaspace.com/v1/files/createfolder',
headers:
{
authorization: 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1bmlxdWVfbmFtZSI6InNhZWlkbWFyb3VmaTY2QGd',
'content-type': 'application/x-www-form-urlencoded' },
form: { path: '/hello', domain: 'yourdomain', type: 'json' } };
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});

Error Example:

{
"result": "ok,
}

{
"result": "error" ,
"message": "Object already exist.",
}

{
"result": "error" ,
"message": "Sorry!Access denied",
}

Upload

Upload a new file with the contents provided in the request!
You can Upload several files with one request and remember that the maximum size for uploading in one request is 2GB.

Url:

api.parsaspace.com/v1/files/upload

Method:

Post

Authentication:

User Authentication

Parameters:

Parameter Entry In Type Description Required
Authorization Headers Bearer <your token>     Your token generated on your profile page required
domain Body String domain specifies the file list. required
path Body String the user must specify the file path, system automatically considers the root path. optional
file Body file send your file. required

Sample Response:

{"result":"success"}

Sample Code:


$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "http://api.parsaspace.com/v1/files/upload2",
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_RETURNTRANSFER=>true,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "------WebKitFormBoundary7MA4YWxkTrZu0gW\r\nContent-Disposition: form-data; name=\"file\"; filename=\" yourfilename \"\r\nContent-Type: text/plain\r\n\r\n\r\n------WebKitFormBoundary7MA4YWxkTrZu0gW\r\nContent-Disposition: form-data; name=\"domain\"\r\n\r\n yourdoamin \r\n------WebKitFormBoundary7MA4YWxkTrZu0gW\r\nContent-Disposition: form-data; name=\"path\"\r\n\r\n/\r\n------WebKitFormBoundary7MA4YWxkTrZu0gW--",
CURLOPT_HTTPHEADER => array(
"authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1bmlxdWVfbmFtZSI6InNhZWlkbWFyb3VmaTY2QGd",
"cache-control: no-cache",
"content-type: multipart/form-data; boundary=---011000010111000001101001",
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
HttpResponse response = Unirest.post("http://api.parsaspace.com/v1/files/upload2")
.header("authorization", "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1bmlxdWVfbmFtZSI6InNhZWlkbWFyb3VmaTY2QGd")
.header("content-type", "("content-type", "multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW")
.body("------WebKitFormBoundary7MA4YWxkTrZu0gW\r\nContent-Disposition: form-data; name=\"file\"; filename=\"yourfilename \"\r\nContent-Type: text/plain\r\n\r\n\r\n------WebKitFormBoundary7MA4YWxkTrZu0gW\r\nContent-Disposition: form-data; name=\"domain\"\r\n\r\n yourdomain \r\n------WebKitFormBoundary7MA4YWxkTrZu0gW\r\nContent-Disposition: form-data; name=\"path\"\r\n\r\n/\r\n------WebKitFormBoundary7MA4YWxkTrZu0gW--")
.asString();
var client = new RestClient("http://api.parsaspace.com/v1/files/upload2");
var request = new RestRequest(Method.POST);
request.AddHeader("authorization", "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1bmlxdWVfbmFtZSI6InNhZWlkbWFyb3VmaTY2QGd");
request.AddParameter("path", "/");
request.domain("domain", "yourdomain");
request.AddFile("file", "yourfilename");
request.AddHeader("content-type", "multipart/form-data; boundary=---011000010111000001101001");
IRestResponse response = client.Execute(request);
import requests
url = "http://api.parsaspace.com/v1/files/upload2"

payload = ""------WebKitFormBoundary7MA4YWxkTrZu0gW\r\nContent-Disposition: form-data; name=\"file\"; filename=\" yourfilename \"\r\nContent-Type: text/plain\r\n\r\n\r\n------WebKitFormBoundary7MA4YWxkTrZu0gW\r\nContent-Disposition: form-data; name=\"domain\"\r\n\r\n yourdoamin \r\n------WebKitFormBoundary7MA4YWxkTrZu0gW\r\nContent-Disposition: form-data; name=\"path\"\r\n\r\n/\r\n------WebKitFormBoundary7MA4YWxkTrZu0gW--""
headers = {
'content-type': "multipart/form-data; boundary=---011000010111000001101001",
'authorization': "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1bmlxdWVfbmFtZSI6InNhZWlkbWFyb3VmaTY2QGd" }

esponse = requests.request("POST", url, data=payload, headers=headers)

print(response.text)
var fs = require("fs");
var request = require("request");

var options = { method: 'POST',
url: 'http://api.parsaspace.com/v1/files/upload2',
headers:
{
'content-type': 'multipart/form-data; boundary=---011000010111000001101001',
authorization: 'youre token' },
formData:
formData:{ file: { value: 'fs.createReadStream(" ")',options:{ filename: 'yourfilename',contentType: null } }, domain: 'yourdomain', path: '/' } };

request(options, function (error, response, body) {
if (error) throw new Error(error);

console.log(body);
});

Error Example:

{
"result": "success",
}

{
"result": "error",
"message": "Object already exist.",
}

{
"result": "error",
"message": "Sorry!Access denied.",
}

Remote Upload

Allows you to upload files from any public HTTP URL, this allows much faster uploading process than uploading the actual files. You can upload files from remote URLs either via a standard upload.

Url:

api.parsaspace.com/v1/remote/new

Method:

Post

Authentication:

User Authentication

Parameter Entry In Type Description Required
Authorization Headers Bearer <your token>     Your token generated on your profile page required
domain Body String domain specifies the file list. required
type Body String it can be json or xml, system automatically consider the json type. optional
path Body String the user must specify the file path, system automatically considers the root path. optional
url Body String the user must specify the file url, and best pattern to separate urls is (,).maximum number of url that you can enter is 100. required
filename Body String the users can specify a name for each url that they entry,and best pattern to separate filenames is (,).if you dont want to insert filename you can place it null; optinal
checkid Body String users must specify an Unique checkid to be informed of the status of their process, it is the user's responsibility to choose the best Unique checkid. required

Sample Response:

{"result":"success"}

Sample Code:

$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "http://api.parsaspace.com/v1/remote/new",
CURLOPT_RETURNTRANSFER=>true,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "checkid=unique checkid &path=your path&url=the url&domain=your domain",
CURLOPT_HTTPHEADER => array(
"authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1bmlxdWVfbmFtZSI6InNhZWlkbWFyb3VmaTY2QGd",

),
));

$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
HttpResponse response = Unirest.post("http://api.parsaspace.com/v1/remote/new")
.header("authorization", "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1bmlxdWVfbmFtZSI6InNhZWlkbWFyb3VmaTY2QGd")
.body("checkid=unique checkid &path=your path t&url=the url&domain=your domain")
.asString();
var client = new RestClient("http://api.parsaspace.com/v1/remote/new");
var request = new RestRequest(Method.POST);
request.AddHeader("authorization", "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1bmlxdWVfbmFtZSI6InNhZWlkbWFyb3VmaTY2QGd");
request.AddParameter("application/x-www-form-urlencoded", "checkid=unique checkid&path=%2Flist&url=your url &domain= your domain", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
import requests
url = "http://api.parsaspace.com/v1/remote/new"
payload = "checkid=unique checkid&path=your path &url=the url&domain=your domain"
headers = {
'authorization': "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1bmlxdWVfbmFtZSI6InNhZWlkbWFyb3VmaTY2QGd",
}
response = requests.request("POST", url, data=payload, headers=headers)
print(response.text)
var request = require("request");
var options = { method: 'POST',
url: 'http://api.parsaspace.com/v1/remote/new',
headers:
{
authorization: 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1bmlxdWVfbmFtZSI6InNhZWlkbWFyb3VmaTY2QGd' },
form:
{ checkid: 'unique checkid'
path: 'your path',
url: 'the url', domain: 'your domain' } };
request(options, function (error, response, body) {
if (error) throw new Error(error);

console.log(body);
});

Error Example:

{
"result": "{"success" },
}

{
"result": "error" ,
}

{
"result": "error" ,
"message": "Sorry!Access denied",
}

Remote Upload Status

Remote Status is used to track the progress of multiple remote operations.

Url:

api.parsaspace.com/v1/remote/status

Method:

Post

Authentication:

User Authentication

Parameter Entry In Type Description Required
Authorization Headers Bearer <your token>     Your token generated on your profile page required
checkid Body String insert to track the progress of multiple remote operations. required

Sample Response:

{"result":"success","list":[{"Url":"your url",FileName:"Uploaded File Name","Status":"queue","DownloadSize":11117}]}

Sample Code:


curl_setopt_array($curl, array(
CURLOPT_URL => "http://api.parsaspace.com/v1/remote/status",
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_RETURNTRANSFER=>true,
CURLOPT_POSTFIELDS => "chechid= your checkid",
CURLOPT_HTTPHEADER => array(
"authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1bmlxdWVfbmFtZSI6InNhZWlkbWFyb3VmaTY2QGd",
),
));
$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
HttpResponse response = Unirest.post("http://api.parsaspace.com/v1/remote/status")
.header("authorization", "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1bmlxdWVfbmFtZSI6InNhZWlkbWFyb3VmaTY2QGd")
.body("chechid=your checkid")
.asString();
var client = new RestClient("http://api.parsaspace.com/v1/remote/status");
var request = new RestRequest(Method.POST);
request.AddHeader("authorization", "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1bmlxdWVfbmFtZSI6InNhZWlkbWFyb3VmaTY2QGd");
request.AddParameter("application/x-www-form-urlencoded", "chechid=your checkid", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
import requests
url = "http://api.parsaspace.com/v1/remote/status"
payload = "chechid=your checkid"
headers = {
'authorization': "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1bmlxdWVfbmFtZSI6InNhZWlkbWFyb3VmaTY2QGd",
}
response = requests.request("POST", url, data=payload, headers=headers)
print(response.text)
var request = require("request");
var options = { method: 'POST',
url: 'http://api.parsaspace.com/v1/remote/status',
headers:
{
authorization: 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1bmlxdWVfbmFtZSI6InNhZWlkbWFyb3VmaTY2QGd' },
form: { chechid: 'your checkid' } };
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});

Error Example:

{
"result": "success,
"list": [ { "Url": "http://trainbit.com/files/6156037884/gulpfile.js",
"Status": "queue",
"DownloadSize": 11117
"FileName:"Uploaded File Name"
}

}

{
"result": "error" ,
}

{
"result": "error" ,
"message": "Sorry!Access denied",
}