Documentação da API

Implemente Object Storage Blockchain de forma simples, rápido e fácil

Exemplo

Segue uma demonstração de como implementar utilizando PHP.
https://github.com/toroscloud/phpsdk

Endpoint

URL para uso da API da Toros Cloud: https://toros.com.br/api

Credenciais

Entre em sua conta e ative a credenciais da API.
- Só é permitido ter apenas uma chave de API por conta.

Autenticação

Endpoint: POST: https://toros.com.br/api/oauth/token

Request

{
	"grant_type":"client_credentials",
	"api_key":"182d6a382e12bce7bc12ecd2b2e1ce0a3b9e3adf415dd758d",
	"api_secret":"14175586414841f47609d5b7fc8f12aa30acf939a8ba82234bf393a2fe4321a80"
}
						 


Result
{
    "success": true,
    "token_type": "Bearer",
    "access_token": "17eaa03f307f57ff643524de6157c565d6775c31dbc199d2f97f014a68c3910dd",
    "refresh_token": "1bdec84e829567548878e494b5af9cbd885a4a8f00b67c0b056c4",
    "message": "Success"
}
						 


Example
curl --location --request POST 'https://toros.com.br/api/oauth/token' \
--header 'Content-Type: text/plain' \
--data-raw '{
	"grant_type":"client_credentials",
	"api_key":"182d6a382e12bce7bc12ecd2b2e1ce0a3b9e3adf415dd758d",
	"api_secret":"14175586414841f47609d5b7fc8f12aa30acf939a8ba82234bf393a2fe4321a80"
}'							 
						 

New bucket

Endpoint: POST: https://toros.com.br/api/bucket
Authorization: Bearer Token

Request

{
	"name":"newbucket"
}
						 


Result
{
    "success": true,
    "message": "Bucket newbucket created"
}
						 


Example
curl --location --request POST 'https://toros.com.br/api/bucket' \
--header 'Authorization: Bearer 17eaa03f307f57ff643524de6157c565d6775c31dbc199d2f97f014a68c3910dd' \
--header 'Content-Type: text/plain' \
--data-raw '{
	"name":"newbucket"
}'					 
						 

Delete bucket

*Atenção, ao remover o bucket todos os arquivos nele também serão excluídos

Endpoint: DELETE: https://toros.com.br/api/bucket/newbucket
Authorization: Bearer Token

Result

{
    "success": true,
    "message": "Bucket newbucket have been deleted"
}
						 


Example
curl --location --request DELETE 'https://toros.com.br/api/bucket/teste9' \
--header 'Authorization: Bearer 128d75c7543eda46a68d55e8445499ee6f19281c9326db36175afc92281f90955' \
						 

Upload

Endpoint: POST: https://toros.com.br/api/bucket/newbucket
Authorization: Bearer Token

Request

form-data
file: arquivo.mp4
destiny: newdirectory/arquivo.mp4 or arquivo.mp4


Example
curl --location --request POST 'https://toros.com.br/api/bucket/newbucket' \
--header 'Authorization: Bearer 1eed0a2bbac152acc6bd5f72e56b82b5f33a065a515cb4a5db9edc2535509a0a8' \
--form '[email protected]/home/user/www/arquivo/arquivo.mp4' \
--form 'destiny=newdirectory/arquivo.mp4'

						 

List file

Endpoint: GET: https://toros.com.br/api/bucket/newbucket
Endpoint: GET: https://toros.com.br/api/bucket/newbucket/newdirectory
Authorization: Bearer Token

Result

{
    "success": true,
    "message": "Bucket newbucket created"
}
						 


Example
curl --location --request GET 'https://toros.com.br/api/bucket/newbucket' \
--header 'Authorization: Bearer 18d14acc751d98bf707927e05b2b05eb66f2ad1872ad0ea1ec1f17105379dbd07'
						 

Delete file

Endpoint: DELETE: https://toros.com.br/api/bucket/newbucket/newdirectory/arquivo.mp4
Authorization: Bearer Token

Result

{
    "success": true,
    "message": "File deleted"
}
						 


Example
curl --location --request DELETE 'https://toros.com.br/api/bucket/newbucket/newdirectory/arquivo.mp4' \
--header 'Authorization: Bearer 128d75c7543eda46a68d55e8445499ee6f19281c9326db36175afc92281f90955' \
						 

List file

Endpoint: GET: https://toros.com.br/api/bucket/newbucket
Endpoint: GET: https://toros.com.br/api/bucket/newbucket/newdirectory
Authorization: Bearer Token

Result

{
    "success": true,
    "message": "Bucket newbucket created"
}
						 


Example
curl --location --request GET 'https://toros.com.br/api/bucket/newbucket' \
--header 'Authorization: Bearer 18d14acc751d98bf707927e05b2b05eb66f2ad1872ad0ea1ec1f17105379dbd07'
						 

Download

Endpoint: GET: https://toros.com.br/api/file/newbucket/newdirectory/arquivo.mp4
Authorization: Bearer Token

Result

{
    "success": true,
    "message": "Bucket newbucket created"
}
						 


Example
curl --location --request GET 'https://toros.com.br/api/bucket/newbucket/newdirectory/arquivo.mp4' \
--header 'Authorization: Bearer 1eed0a2bbac152acc6bd5f72e56b82b5f33a065a515cb4a5db9edc2535509a0a8' \
						 

Você tem alguma dúvida?

Entre em contato com nosso suporte.

Contato