curl --request POST \
--url https://prod01-apigw.{customer_name}.fabric.zone/api-identity/auth/local/login \
--header 'Content-Type: application/json' \
--header 'x-site-context: <x-site-context>' \
--data '
{
"accountId": 4781348886,
"username": "john@fabric.inc",
"password": "joHn@123456789!"
}
'import requests
url = "https://prod01-apigw.{customer_name}.fabric.zone/api-identity/auth/local/login"
payload = {
"accountId": 4781348886,
"username": "john@fabric.inc",
"password": "joHn@123456789!"
}
headers = {
"x-site-context": "<x-site-context>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-site-context': '<x-site-context>', 'Content-Type': 'application/json'},
body: JSON.stringify({
accountId: 4781348886,
username: 'john@fabric.inc',
password: 'joHn@123456789!'
})
};
fetch('https://prod01-apigw.{customer_name}.fabric.zone/api-identity/auth/local/login', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://prod01-apigw.{customer_name}.fabric.zone/api-identity/auth/local/login",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'accountId' => 4781348886,
'username' => 'john@fabric.inc',
'password' => 'joHn@123456789!'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-site-context: <x-site-context>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://prod01-apigw.{customer_name}.fabric.zone/api-identity/auth/local/login"
payload := strings.NewReader("{\n \"accountId\": 4781348886,\n \"username\": \"john@fabric.inc\",\n \"password\": \"joHn@123456789!\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-site-context", "<x-site-context>")
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://prod01-apigw.{customer_name}.fabric.zone/api-identity/auth/local/login")
.header("x-site-context", "<x-site-context>")
.header("Content-Type", "application/json")
.body("{\n \"accountId\": 4781348886,\n \"username\": \"john@fabric.inc\",\n \"password\": \"joHn@123456789!\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://prod01-apigw.{customer_name}.fabric.zone/api-identity/auth/local/login")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-site-context"] = '<x-site-context>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"accountId\": 4781348886,\n \"username\": \"john@fabric.inc\",\n \"password\": \"joHn@123456789!\"\n}"
response = http.request(request)
puts response.read_body{
"_id": "60c3a2c476f9c21239d836ca",
"account": {
"accountId": 8739392294
},
"roles": [
"Admin"
],
"permissions": [
"read:user"
],
"refreshToken": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVC.eyJpZCI6IjYwYzNhMmM0....",
"accessToken": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVC.eyJpZCI6IjYwYzNhMmM0...."
}{
"code": "BAD_REQUEST",
"message": "Bad Request"
}{
"code": "INTERNAL_SERVER_ERROR",
"message": "Internal server error."
}Generate authorization token for local user
Generates an authorization token using which you can access fabric APIs. Ensure that you provide valid credentials to get an authorization token.
curl --request POST \
--url https://prod01-apigw.{customer_name}.fabric.zone/api-identity/auth/local/login \
--header 'Content-Type: application/json' \
--header 'x-site-context: <x-site-context>' \
--data '
{
"accountId": 4781348886,
"username": "john@fabric.inc",
"password": "joHn@123456789!"
}
'import requests
url = "https://prod01-apigw.{customer_name}.fabric.zone/api-identity/auth/local/login"
payload = {
"accountId": 4781348886,
"username": "john@fabric.inc",
"password": "joHn@123456789!"
}
headers = {
"x-site-context": "<x-site-context>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-site-context': '<x-site-context>', 'Content-Type': 'application/json'},
body: JSON.stringify({
accountId: 4781348886,
username: 'john@fabric.inc',
password: 'joHn@123456789!'
})
};
fetch('https://prod01-apigw.{customer_name}.fabric.zone/api-identity/auth/local/login', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://prod01-apigw.{customer_name}.fabric.zone/api-identity/auth/local/login",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'accountId' => 4781348886,
'username' => 'john@fabric.inc',
'password' => 'joHn@123456789!'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-site-context: <x-site-context>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://prod01-apigw.{customer_name}.fabric.zone/api-identity/auth/local/login"
payload := strings.NewReader("{\n \"accountId\": 4781348886,\n \"username\": \"john@fabric.inc\",\n \"password\": \"joHn@123456789!\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-site-context", "<x-site-context>")
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://prod01-apigw.{customer_name}.fabric.zone/api-identity/auth/local/login")
.header("x-site-context", "<x-site-context>")
.header("Content-Type", "application/json")
.body("{\n \"accountId\": 4781348886,\n \"username\": \"john@fabric.inc\",\n \"password\": \"joHn@123456789!\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://prod01-apigw.{customer_name}.fabric.zone/api-identity/auth/local/login")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-site-context"] = '<x-site-context>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"accountId\": 4781348886,\n \"username\": \"john@fabric.inc\",\n \"password\": \"joHn@123456789!\"\n}"
response = http.request(request)
puts response.read_body{
"_id": "60c3a2c476f9c21239d836ca",
"account": {
"accountId": 8739392294
},
"roles": [
"Admin"
],
"permissions": [
"read:user"
],
"refreshToken": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVC.eyJpZCI6IjYwYzNhMmM0....",
"accessToken": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVC.eyJpZCI6IjYwYzNhMmM0...."
}{
"code": "BAD_REQUEST",
"message": "Bad Request"
}{
"code": "INTERNAL_SERVER_ERROR",
"message": "Internal server error."
}Headers
The x-site-context is a JSON object that must contain date, and channel attributes. eg - {"date":"2020-12-12T08:00:00.000Z","channel":12}
Show child attributes
Show child attributes
Body
Response
OK
fabric internal ID
"60c3a2c476f9c21239d836ca"
Copilot account information
Show child attributes
Show child attributes
List of available roles for the user
Role description, such as administrator, manager, and so on
List of available permissions for the user
Permission description
Refresh token
"eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVC.eyJpZCI6IjYwYzNhMmM0...."
Access Token. This is the token to consume the copilot APIs.
"eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVC.eyJpZCI6IjYwYzNhMmM0...."
Was this page helpful?
