Quick Start
Получить токен доступа
Для получения токена доступа, вам необходимо перейти в администрирование системы в раздел API https://admin.myfreshcloud.com/settings-api
Метод авторизации
Bearer Token ⚡️ Content-Type : application/json
--header 'Authorization: Bearer XXXXXXX.XXXXXXXX.XXXXXXX' CURLOPT_HTTPHEADER => array(
'Authorization: Bearer XXXXXXX.XXXXXX.XXXXXXXXX'
)'headers': {
'Authorization': 'Bearer XXXXXXX.XXXXXXX.XXXXXXX'
}
// Some code
constructor(private http: HttpClient) { }
// Some code
public GetWelcome() : Observable<any>
{
var token = "XXXXXX.XXXXXX.XXXXXX";
return this.http.get("https://do.myfreshcloud.com/welcome",
{ headers:
{"Authorization" : `Bearer ${token}`}
});
}
Первый запрос и первый ответ
Для начала давайте получим ответ Welcome! ⚡️Это запрос должен содержать токен авторизации
Welcome!
GET https://do.myfreshcloud.com/welcome/first
Headers
Name
Type
Description
Content-Type
String
application/json
Authorization*
String
Bearer XXXXX.XXXXX.XXXXX
{
"status": "success",
"error": null,
"code": null,
"rows": 1,
"pages": 1,
"page": 1,
"value": "Welcome! And let's continue: https://apidoc.myfreshcloud.com/"
}curl --location --request GET 'https://do.myfreshcloud.com/welcome/first' \
--header 'Authorization: Bearer XXXXXXX.XXXXXXX.XXXXXX'<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://do.myfreshcloud.com/welcome/first',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_HTTPHEADER => array(
'Authorization: Bearer XXXXXX.XXXXXXX.XXXXXX'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;var request = require('request');
var options = {
'method': 'GET',
'url': 'https://do.myfreshcloud.com/welcome/first',
'headers': {
'Authorization': 'Bearer XXXXXX.XXXXXXX.XXXXXX'
}
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});// Some code
constructor(private http: HttpClient) { }
// Some code
public GetWelcome() : Observable<any>
{
var token = "XXXXXX-XXXXX-XXXXX";
return this.http.get("https://do.myfreshcloud.com/welcome/first",
{ headers:
{"Authorization" : `Bearer ${token}`}
});
}
Объект ответа
{
"status": "success",
"error": null,
"code": null,
"rows": 1,
"pages": 1,
"page": 1,
"value": "Welcome! And let's continue: https://apidoc.myfreshcloud.com/"
}
// status - статус выполнения [success] [error]
// error - текст ошибки, при наличии
// code - код ошибки при наличии
// rows - количество строк
// pages - количество страниц
// page - текущая страница
// value - запрошенные данные, обычно в формате JSON
Last updated
Was this helpful?