We have made our Api simple to understand and have also provided usage examples in various programming languages to help developers explore them.
sCloud Api uses the {JSON} Protocol that returns JSON-encoded responses and uses standard HTTP response codes, authentication.
This first section describes connecting to the API with endpoints and then also how to connect using the SDK and also non SDK examples.
If you prefer to not use the endpoints directly you can jump straight in using a ready made Library/SDK
You need to register your app in the developers console before you can use the API.
1. User authentication and authorizing your app
sCloud uses OAuth 2.0 for API authentication, authorization and to generate access tokens.
Authorization flow
GET https://api.scloud.live/oauth2?client_id={client_id}&scope={scope}
&response_type=token&redirect_uri={redirect_uri}
GET https://api.scloud.live/oauth2?client_id={client_id}&scope={scope}
&response_type=token&redirect_uri={redirect_uri}
Once your app is authorized and has received an access token, it can then make requests to the sCloud endpoint.
curl -X POST "https://scloud.live/Apiv1/Cloud" \
--header "Authorization: Bearer < OAUTH2_ACCESS_TOKEN >"
2. Call Requests
cloud":
{
"storage_used":"132GB",
"Video":[["example.pm4",
"example2.mp4","example4.mp4","example5.mp4","..."]]
"Images":[["1.jpg","2.JPG","3.JPG","4.JPG"]]
}"
the $json_data array will contain all information relating to the account
connected to the access key.
Example using our SDK
$url = "https://scloud.live/Apiv1/API.php?api_key=26ba6ba27725kj";
$json = file_get_contents($url);
$json_data = json_decode($json, true);
//print_r($json_data);
$storage_used=$json_data[cloud][storage_used];
//echo $storage_used;
//or
//array containing File Names of videos in the Videos folder
$videos=$json_data[cloud]['videos'];
print_r($videos);
$json_data[cloud][Images][0][22];
OUTPUT:
suncloudinthesky.png
Account - Accessing Account information
$json_data[account][username];
$json_data[account][email];//will be obsolete in the future
$json_data[account][account_type];//free or premium
$json_data[account][creation_date];//date account was created