cURL
curl -X POST \
https://api.sakari.io/oauth2/token \
-H 'Content-Type: application/json' \
-d '{
"grant_type": "client_credentials",
"client_id": "12345678-1234-1234-1234-123456789012",
"client_secret": "87654321-4321-4321-4321-098765432121"
}'var settings = {
"async": true,
"crossDomain": true,
"url": "https://api.sakari.io/oauth2/token",
"method": "POST",
"headers": {
"Content-Type": "application/json"
},
"processData": false,
"data": "{\n\t\"grant_type\": \"client_credentials\",\n\t\"client_id\": \"12345678-1234-1234-1234-123456789012\",\n\t\"client_secret\": \"87654321-4321-4321-4321-098765432121\"\n}"
}
$.ajax(settings).done(function (response) {
console.log(response);
});
<?php
$request = new HttpRequest();
$request->setUrl('https://api.sakari.io/oauth2/token');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders(array(
'Content-Type' => 'application/json'
));
$request->setBody('{
"grant_type": "client_credentials",
"client_id": "12345678-1234-1234-123456789012",
"client_secret": "87654321-4321-4321-898765432121"
}');
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
import requests
url = "https://api.sakari.io/oauth2/token"
payload = {
"grant_type": "client_credentials",
"client_id": "00000000-0000-0000-0000-00000000000",
"client_secret": "00000000-0000-0000-0000-00000000000"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.sakari.io/oauth2/token"
payload := strings.NewReader("{\n \"grant_type\": \"client_credentials\",\n \"client_id\": \"00000000-0000-0000-0000-00000000000\",\n \"client_secret\": \"00000000-0000-0000-0000-00000000000\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.sakari.io/oauth2/token")
.header("Content-Type", "application/json")
.body("{\n \"grant_type\": \"client_credentials\",\n \"client_id\": \"00000000-0000-0000-0000-00000000000\",\n \"client_secret\": \"00000000-0000-0000-0000-00000000000\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sakari.io/oauth2/token")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"grant_type\": \"client_credentials\",\n \"client_id\": \"00000000-0000-0000-0000-00000000000\",\n \"client_secret\": \"00000000-0000-0000-0000-00000000000\"\n}"
response = http.request(request)
puts response.read_body{
"access_token": "<string>",
"token_type": "<string>"
}{
"success": true,
"error": {
"code": "CONT-010",
"description": "Contact has requested no further communication"
}
}{
"success": true,
"error": {
"code": "CONT-010",
"description": "Contact has requested no further communication"
}
}authentication
Get token for accessing APIs
POST
/
oauth2
/
token
cURL
curl -X POST \
https://api.sakari.io/oauth2/token \
-H 'Content-Type: application/json' \
-d '{
"grant_type": "client_credentials",
"client_id": "12345678-1234-1234-1234-123456789012",
"client_secret": "87654321-4321-4321-4321-098765432121"
}'var settings = {
"async": true,
"crossDomain": true,
"url": "https://api.sakari.io/oauth2/token",
"method": "POST",
"headers": {
"Content-Type": "application/json"
},
"processData": false,
"data": "{\n\t\"grant_type\": \"client_credentials\",\n\t\"client_id\": \"12345678-1234-1234-1234-123456789012\",\n\t\"client_secret\": \"87654321-4321-4321-4321-098765432121\"\n}"
}
$.ajax(settings).done(function (response) {
console.log(response);
});
<?php
$request = new HttpRequest();
$request->setUrl('https://api.sakari.io/oauth2/token');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders(array(
'Content-Type' => 'application/json'
));
$request->setBody('{
"grant_type": "client_credentials",
"client_id": "12345678-1234-1234-123456789012",
"client_secret": "87654321-4321-4321-898765432121"
}');
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
import requests
url = "https://api.sakari.io/oauth2/token"
payload = {
"grant_type": "client_credentials",
"client_id": "00000000-0000-0000-0000-00000000000",
"client_secret": "00000000-0000-0000-0000-00000000000"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.sakari.io/oauth2/token"
payload := strings.NewReader("{\n \"grant_type\": \"client_credentials\",\n \"client_id\": \"00000000-0000-0000-0000-00000000000\",\n \"client_secret\": \"00000000-0000-0000-0000-00000000000\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.sakari.io/oauth2/token")
.header("Content-Type", "application/json")
.body("{\n \"grant_type\": \"client_credentials\",\n \"client_id\": \"00000000-0000-0000-0000-00000000000\",\n \"client_secret\": \"00000000-0000-0000-0000-00000000000\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sakari.io/oauth2/token")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"grant_type\": \"client_credentials\",\n \"client_id\": \"00000000-0000-0000-0000-00000000000\",\n \"client_secret\": \"00000000-0000-0000-0000-00000000000\"\n}"
response = http.request(request)
puts response.read_body{
"access_token": "<string>",
"token_type": "<string>"
}{
"success": true,
"error": {
"code": "CONT-010",
"description": "Contact has requested no further communication"
}
}{
"success": true,
"error": {
"code": "CONT-010",
"description": "Contact has requested no further communication"
}
}⌘I