authorize_user
curl --request POST \
--url 'http://{{base_url}}/api/v1/user/authorize_user' \
--header 'Content-Type: application/json' \
--data '
{
"password": "<Your-password>",
"user_name": "<Your-username>"
}
'import requests
url = "http://{{base_url}}/api/v1/user/authorize_user"
payload = {
"password": "<Your-password>",
"user_name": "<Your-username>"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({password: '<Your-password>', user_name: '<Your-username>'})
};
fetch('http://{{base_url}}/api/v1/user/authorize_user', 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 => "http://{{base_url}}/api/v1/user/authorize_user",
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([
'password' => '<Your-password>',
'user_name' => '<Your-username>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$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 := "http://{{base_url}}/api/v1/user/authorize_user"
payload := strings.NewReader("{\n \"password\": \"<Your-password>\",\n \"user_name\": \"<Your-username>\"\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("http://{{base_url}}/api/v1/user/authorize_user")
.header("Content-Type", "application/json")
.body("{\n \"password\": \"<Your-password>\",\n \"user_name\": \"<Your-username>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://{{base_url}}/api/v1/user/authorize_user")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"password\": \"<Your-password>\",\n \"user_name\": \"<Your-username>\"\n}"
response = http.request(request)
puts response.read_body{
"error": false,
"status": "success",
"code": 200,
"data": {
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoxLCJlbWFpbCI6ImdhdXJhdkBqeW90aXN5YS5haSIsInVzZXJfbmFtZSI6ImhnbGkiLCJwaG9uZV9udW1iZXIiOiI5MTgzNDA1NjIwMzYiLCJmaXJzdF9uYW1lIjoiR2F1cmF2IiwibGFzdF9uYW1lIjoiS3VtYXIiLCJ3aGFyc2FwcF9udW1iZXIiOiI5MTc2NzY1ODQ2MDIiLCJpc19maXJzdF9sb2dpbiI6ZmFsc2UsImlhdCI6MTcwOTU0NzAxMywiZXhwIjoxNzI1MDk5MDEzLCJpc3MiOiJhcGkud2F0by5haSJ9.o_W-5oMzZMbESnhWfOeSYJ2iFjCWZv8G47spseqgLnE",
"user_info": {
"user_id": 1,
"email": "abc@xyz.com",
"user_name": "<username>",
"phone_number": "<phone_number>",
"first_name": "<first_name>",
"last_name": "<last_name>",
"wharsapp_number": "<whatsapp_number>",
"is_first_login": false
}
}
}User
Authorize user
This is request to authorize existing user to use dashboard
| field_name | data_type | comment |
|---|---|---|
| user_name | string | |
| password | string |
POST
/
api
/
v1
/
user
/
authorize_user
authorize_user
curl --request POST \
--url 'http://{{base_url}}/api/v1/user/authorize_user' \
--header 'Content-Type: application/json' \
--data '
{
"password": "<Your-password>",
"user_name": "<Your-username>"
}
'import requests
url = "http://{{base_url}}/api/v1/user/authorize_user"
payload = {
"password": "<Your-password>",
"user_name": "<Your-username>"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({password: '<Your-password>', user_name: '<Your-username>'})
};
fetch('http://{{base_url}}/api/v1/user/authorize_user', 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 => "http://{{base_url}}/api/v1/user/authorize_user",
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([
'password' => '<Your-password>',
'user_name' => '<Your-username>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$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 := "http://{{base_url}}/api/v1/user/authorize_user"
payload := strings.NewReader("{\n \"password\": \"<Your-password>\",\n \"user_name\": \"<Your-username>\"\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("http://{{base_url}}/api/v1/user/authorize_user")
.header("Content-Type", "application/json")
.body("{\n \"password\": \"<Your-password>\",\n \"user_name\": \"<Your-username>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://{{base_url}}/api/v1/user/authorize_user")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"password\": \"<Your-password>\",\n \"user_name\": \"<Your-username>\"\n}"
response = http.request(request)
puts response.read_body{
"error": false,
"status": "success",
"code": 200,
"data": {
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoxLCJlbWFpbCI6ImdhdXJhdkBqeW90aXN5YS5haSIsInVzZXJfbmFtZSI6ImhnbGkiLCJwaG9uZV9udW1iZXIiOiI5MTgzNDA1NjIwMzYiLCJmaXJzdF9uYW1lIjoiR2F1cmF2IiwibGFzdF9uYW1lIjoiS3VtYXIiLCJ3aGFyc2FwcF9udW1iZXIiOiI5MTc2NzY1ODQ2MDIiLCJpc19maXJzdF9sb2dpbiI6ZmFsc2UsImlhdCI6MTcwOTU0NzAxMywiZXhwIjoxNzI1MDk5MDEzLCJpc3MiOiJhcGkud2F0by5haSJ9.o_W-5oMzZMbESnhWfOeSYJ2iFjCWZv8G47spseqgLnE",
"user_info": {
"user_id": 1,
"email": "abc@xyz.com",
"user_name": "<username>",
"phone_number": "<phone_number>",
"first_name": "<first_name>",
"last_name": "<last_name>",
"wharsapp_number": "<whatsapp_number>",
"is_first_login": false
}
}
}Body
application/json
The body is of type object.
Response
200 - application/json
OK
The response is of type object.