Business Unit

Estimated reading: 2 minutes

Description:

This API allows you to retrieve Business Units from various platforms such as web browsers, native applications in Android, and iOS.

URL:

				
					http://<server-ip-address>/custom_api/business_unit
				
			
Method: GET
URL Parameters Required
format=json (In future, Maybe change to default)
Yes
Optional
No

Form Data Parameters:

No

Header Parameters:

Authorization:

				
					Bearer <Token> (Replace <Token> with the actual access token)
				
			
Success Response:

Code: 200

Content:

				
					{
  "code": 200,
  "message": "success",
  "data": [
    {
      "id": 9096,
      "name": " / Aurora"
    },
    {
      "id": 9099,
      "name": " / Aurora / Group 1"
    },
    {
      "id": 9102,
      "name": " / Aurora / Group 1 / Building A New"
    }
  ]
}

				
			
Error Response:

Code: 401 BAD REQUEST

Content:

				
					{
  "code": 401,
  "message": "fail",
  "data": {
    "error": "Invalid API Token"
  }
}

				
			

Notes

Code Examples:

cURL Example:

				
					curl -X GET "http://<server-ip-address>/custom_api/business_unit?format=json" -H "Authorization: Bearer <Token>"
				
			
PHP Example:
				
					<?php
$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'http://<server-ip-address>/custom_api/business_unit?format=json',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_HTTPHEADER => array(
    'Authorization: Bearer <Token>'
  )
));

$response = curl_exec($curl);
curl_close($curl);

echo $response;
?>

				
			
JavaScript Example (using Fetch API):
				
					const url = 'http://<server-ip-address>/custom_api/business_unit?format=json';
const token = '<Token>';

fetch(url, {
  method: 'GET',
  headers: {
    'Authorization': `Bearer ${token}`
  }
})
  .then(response => response.json())
  .then(data => console.log(data))
  .catch(error => console.error(error));

				
			
Note:
Share this Doc

Business Unit

Or copy link

CONTENTS