Organization
Endpoints Summary
GET
/organization/
Swagger ↗
The Organization API provides access to
organizationalyourhierarchyorganizationdata,hierarchy, allowingusersyou to retrieve information abouttheiryour primary organization and allassociatedsub-organizationssub-organizations.you have access to. This endpoint is essential for understanding organizational structure,managing multi-tenant applications, andfiltering data byorganizationalorganization,scope.and building organization-aware applications.
Base URL: https://gate.zequenze.com/api/v1
Authentication: All endpoints require a Bearer token:
Authorization: Bearer <your-api-token>
Overview
The Organization API enables developers to access and navigate organizational hierarchiesdata within the GATE system.platform. Organizations in GATE represent hierarchical business entities that can contain sub-organizations, making it ideal for managing multi-location businesses, franchises, or enterprise divisions.
This API is particularly valuableuseful forfor:
Key Concepts:
CommonThe Useendpoint Cases:
Endpoints
GET /organization/
Description: Retrieves a paginated list of organizations that the authenticated user has access to, including their primary organization and allany sub-organizations. This endpoint supports filtering byand variouspagination, making it suitable for both complete organization attributeslists and providestargeted comprehensive organization details including hierarchy information.searches.
Use Cases:
PopulatePopulating organizationselectiondropdown menus inuser interfacesapplicationsBuildBuilding organizational charts and hierarchy visualizationsFilterFilteringother API callsdatasets byorganizationspecificscopeorganizationsDisplayAudituser'strailsaccessibleshowing which organizationsinamulti-user can access
Full URL Example:
https://gate.zequenze.com/api/v1/organization/?name=headquarters&is_active=true&limit=20&offset=0
Parameters:
| Parameter | Type | In | Required | Description |
|---|---|---|---|---|
| id | string | query | No | Filter organizations by specific ID |
| name | string | query | No | Filter organizations by name (supports partial matching) |
| parent | string | query | No | Filter |
| limit | integer | query | No | Number of results to return per page ( |
| offset | integer | query | No | The initial index from which to return results |
cURL Example:
curl -X GET "https://gate.zequenze.com/api/v1/organization/?limit=10&is_active=true"offset=0" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json"
Example Response:
{
"count": 25,
"next": "https://gate.zequenze.com/api/v1/organization/?limit=10&offset=10",
"previous": null,
"results": [
{
"id": 1,
"name": "GlobalAcme Corporation Headquarters",
"short_name": "hq-global"acme-hq",
"is_active": true,
"deleted": false,
"country_code": "US",
"platform": 31,1,
"description": "Main headquarters managingfor globalAcme operations"Corporation",
"parent": null,
"parent_obj": null,
"created": "2024-01-15T10:30:00Z"
},
{
"id": 2,
"name": "NorthAcme AmericaWest Coast Division",
"short_name": "na-division"acme-west",
"is_active": true,
"deleted": false,
"country_code": "US",
"platform": 15,2,
"description": "NorthWest AmericanCoast operations division",
"parent": 1,
"parent_obj": {
"id": 1,
"name": "GlobalAcme Corporation Headquarters",
"short_name": "hq-global"acme-hq",
"is_active": true,
"deleted": false,
"country_code": "US",
"platform": 31,1,
"description": "Main headquarters managingfor globalAcme operations"Corporation",
"parent": null,
"created": "2024-01-15T10:30:00Z"
},
"created": "2024-01-20T14:45:02-01T14:20:00Z"
},
{
"id": 3,
"name": "Acme European Division"Office",
"short_name": "eu-division"acme-eu",
"is_active": true,
"deleted": false,
"country_code": "DE",
"platform": 7,4,
"description": "European operations division"center",
"parent": 1,
"parent_obj": {
"id": 1,
"name": "GlobalAcme Corporation Headquarters",
"short_name": "hq-global"acme-hq",
"is_active": true,
"deleted": false,
"country_code": "US",
"platform": 31,1,
"description": "Main headquarters managingfor globalAcme operations"Corporation",
"parent": null,
"created": "2024-01-15T10:30:00Z"
},
"created": "2024-01-22T09:03-10T09:15:00Z"
}
]
}
Platform Values:
The platform field uses bitwise flags that can be combined:
Response Codes:
| Status | Description |
|---|---|
| 200 | Success - Returns paginated |
| 401 | Unauthorized - Invalid or missing authentication token |
| 403 | Forbidden - User |
| 500 | Internal Server Error - Server-side error occurred |
Common Use Cases
Use Case 1: Building Organization Selector
Retrieve all accessibleactive organizations to populate a dropdown menu forin filteringyour application, allowing users to filter data or switch context switchingbetween in multi-tenant applications.
Example:organizations.
curl -X GET "https://gate.zequenze.com/api/v1/organization/?is_active=true&limit=50" \
-H "Authorization: Bearer YOUR_API_TOKEN"100
Use Case 2: DisplayingLoading Organizational HierarchySub-Organizations
Fetch organizations and use the parent_obj data to build hierarchical tree views showing organizational structure.
Example:
curl -X GET "https://gate.zequenze.com/api/v1/organization/" \
-H "Authorization: Bearer YOUR_API_TOKEN"
Use Case 3: Regional Organization Filtering
Filter organizations by country or region to display location-specific data.
Example:
curl -X GET "https://gate.zequenze.com/api/v1/organization/?country_code=US" \
-H "Authorization: Bearer YOUR_API_TOKEN"
Use Case 4: Finding Sub-organizations
RetrieveGet all child sub-organizations under a specific parent organization forto departmentalbuild views.
Example:views or organizational charts.
curl -X GET "https://gate.zequenze.com/api/v1/organization/?parent=1" \
-H "Authorization: Bearer YOUR_API_TOKEN"1&is_active=true
Use Case 5:3: Organization Search
Search for organizations by name to helpimplement usersorganization quicklylookup findfunctionality specificin organizationalyour units.
Example:application.
curl -X GET "https://gate.zequenze.com/api/v1/organization/?name=division"west&limit=10
\
Use "Authorization:Case Bearer4: YOUR_API_TOKEN"Paginated Organization List
Load organizations in batches for large datasets, implementing proper pagination in your user interface.
https://gate.zequenze.com/api/v1/organization/?limit=20&offset=40
Use Case 5: Organization Validation
Verify if a specific organization exists and is accessible to the current user by filtering by ID.
https://gate.zequenze.com/api/v1/organization/?id=123
Best Practices
-
PaginationUse pagination wisely:Always useSet appropriatelimitvalues (10-50 items) to balance performance andoffsetuserparametersexperience.forDon'tlargerequestorganizationalallstructuresorganizationstoatmaintainonceperformanceif you have many. -
Caching:Cache organization data:locally when possible, as organizationalOrganization structures typically don't changefrequentlyfrequently, so implement client-side caching to reduce API calls and improve application performance. -
HierarchyHandleNavigationhierarchy properly:UseWhen working with parent-child relationships, use theparent_objfieldnested data tobuild efficient tree structures withoutavoid additional API calls for parent organization details. -
ActiveFilterFilteringinactive organizations:FilterInbymost user-facing scenarios, filter foris_active=trueintouser-facinghideinterfacesdeactivated organizations from users unlessyouspecificallyneedmanagingtoorganizationshowstatus.inactive organizations -
Platform Filtering: Decode platform bitwise values to show relevant organizations based on the current application context
Use short_name for URLs: The short_name field is designed for use in URLs and identifiers - it's URL-safe and human-readable.
Respect platform values: The platform field uses bitwise flags (1, 2, 4, 8, 16, 32, 64) - understand your platform requirements before filtering on this field.