Introduction
This Article covers an approach to managing users in Astrato using API calls.
This is primarily relevant for embedded solutions where the users don't sign in to Astrato directly.
Below is a typical flow of user authentication and group management.
Prerequisites
A Personal Access Token for the Astrato API.
* Currently, this feature is in private access state.
please reach out to Astrato Support if you want it enabled.
Follow this article to generate an API Token
API calls
This section covers the API calls required to complete the flow described above.
Create a user in Astrato using Web Ticketing
Get Tenant Users
An endpoint that returns the list of users in the Astrato tenant.
Call type: GET
Call structure: https://app.astrato.io/api/message/tenant/{tenant id}/user?filter={"search":"xxx"}
Authentication bearer Token
Example: https://app.astrato.io/api/message/tenant/ccb4a5d5-ced7-449f-b259-XXXXXXXX/user?filter={"search":"liron"}
Response:
{
"id": "cf379e9f-2292-40f7-XXXX",
"email": "XXXX@astrato.io",
"name": "XXX",
"firstName": "XXX",
"lastName": "XXX",
"imageUrl": "XX.png",
"created": "2024-09-13T16:22:15.331Z",
"updated": "2024-09-16T13:49:16.524Z",
"isPending": false,
"active": true,
"teamId": "52307d50-de57-4cc7-XXXX",
"role": "administrator",
"licenseType": "consumption",
"creditsConsumed": 15,
"creationOrigin": "internal",
"is2FAEnabled": false,
"twoFASetupDueDate": null
}
Get Tenant Groups
An endpoint that returns the list of groups in the Astrato tenant.
Call type: GET
Call structure: https://app.astrato.io/api/message/tenant/{tenant id}/group?filter={"displayName":"xxx"}
Authentication bearer Token
Example: https://app.astrato.io/api/message/tenant/ccb4a5d5-ced7-449f-b259-xxx/group
Response:
{
"id": "XXX",
"displayName": "myGroup",
"description": null,
"created": "2024-09-16T08:23:00.162Z",
"updated": "2024-09-16T08:23:00.162Z",
"creationOrigin": "internal",
"externalId": null,
"membersQuantity": 2
}
Create a New Group
An endpoint that creates a new group in the tenant
Call type: POST
Call structure: Header: https://app.astrato.io/api/message/tenant/{tenant id}/group
Body: {displayName:”XXX”,description:”XXX”}
Authentication bearer Token
Example: https://app.astrato.io/api/message/tenant/ccb4a5d5-ced7-449f-xxx-xxx/group
{displayName:”LironGroup”,description:”Liron API Group”}
Response:
{
"id": "xxx",
"displayName": "LironGroup",
"description": "Liron API Group",
"created": "2024-09-16T14:06:54.695Z",
"updated": "2024-09-16T14:06:54.695Z",
"creationOrigin": "internal",
"externalId": null
}
Add a User to a Group
An endpoint that adds a user to an existing group in the tenant
Call type: POST
Call structure: Header: https://app.astrato.io/api/message/tenant/{tenant id}/group/{group id}/members
Body: {members:[{resourceID:”XXX”,resourceType:”user”}
Authentication bearer Token
Example: https://app.astrato.io/api/message/tenant/ccb4a5d5-ced7-449f-xx-xxx/group/96b2e9d9-027f-40cc-9021-xxx/members
{members:[{"resourceId":"b6e03119-26dd-4e7b-xx-xxx","resourceType":"user"}]}
Response:
[
{
"id": "xxx",
"email": "xxxx",
"name": "Rand",
"resourceId": "xxxx",
"resourceType": "user",
"tenantGroupId": "96b2e9d9-027f-40cc-9021-bc3996cfa83a",
"imageUrl": "xxx",
"created": "2024-09-16T14:16:19.069Z",
"creationOrigin": "internal"
}
]