Overview of Organization API
This set of API calls allow you to get, create, edit, and delete organizations and return all the users in a particular organization.
The following API calls are available:
- Get Organizations for Current User
- Get Organization by ID
- Create Organization
- Edit Organization
- Delete Organization
- Get Organization Users
Get Organizations for Current User
Endpoint
GET /passportsvc/api/v1/organizations
Request
Parameters
Query
| Parameter | Type | Description | Required |
|---|---|---|---|
_name | String | Filter by name of the organization | Optional |
_userType | String | Filter by user type | Optional |
_shortName | String | Filter by short name | Optional |
query | String | Wild card search on name, short name and description(For ex: ?query=xyz) | Optional |
_offset | Number | Enter an offset value for the pagination response. | Optional |
_pageSize | Number | Enter a number for the ammount of applications you want to return per page. | Optional |
Response
Body
{
"_offset": 0,
"_pageSize": 2,
"_total": 2,
"_list": [
{
"_id": "36a1eb2b-06bd-426e-a3ce-e7ab609ea825",
"_name": "ABC Ltd",
"_description": "ABC Ltd",
"_userType": "external",
"_namespaces": [
"abcl_KQXXC4v5"
],
"_metadata": {
"_createdAt": 1707081965089,
"_updatedAt": 1707084681466,
"_createdById": "3259cd1a-a350-43fb-8447-9c21d2938fb7",
"_updatedById": "3259cd1a-a350-43fb-8447-9c21d2938fb7"
},
"_orgOwner": "251e73a2-1c91-400f-aa6f-8cfab6cc2a79",
"_shortName": "abc_ltd"
},
{
"_id": "325d47a3-0963-40cd-934f-252844e58425",
"_name": "XYZ",
"_description": "",
"_userType": "platform_org",
"_namespaces": [
"xyz_oR3kTC5t"
],
"_metadata": {},
"_orgOwner": "3259cd1a-a350-43fb-8447-9c21d2938fb7",
"_shortName": "platform_org"
}
]
}
Get Organization by ID
Endpoint
GET /passportsvc/api/v1/organizations/{id}
Request
Parameters
Path
| Parameter | Type | Description | Required |
|---|---|---|---|
id | String | The organization's ID. | Required |
Response
Codes
| Code | Description |
|---|---|
200 | Success |
404 | Not Found |
Body
{
"_id": "325d47a3-0963-40cd-934f-252844e58425",
"_name": "XYZ",
"_description": "",
"_userType": "platform_org",
"_namespaces": [
"xyz_oR3kTC5t"
],
"_metadata": {},
"_orgOwner": "3259cd1a-a350-43fb-8447-9c21d2938fb7",
"_shortName": "platform_org"
}
Create Organization
Creates an organization with the parameters you pass.
Endpoint
POST /passportsvc/api/v1/organizations
Authorization
Platform manager who gets access token from console app can create organization.
Request
Parameters
Body
| Parameter | Type | Description | Required |
|---|---|---|---|
_name | Number | Pass the organization's name. | Required |
_orgOwner | String | Pass the email address of the user you want to have all permissions for the organization. The org owner can provide access to other users by adding/invite organization owner group. | Required |
_userType | String | Pass a string that defines the organization's type. Use this label to identify resources of the same type. | Optional |
_shortName | String | Give the organization a shorter name that will be unique across the platform. If you do not pass a value, _name is the short name by default | Optional |
Code example
{
"_name": "ABC Ltd",
"_orgOwner": "abc_org_owner@abc.com",
"_userType":"external"
}
Response
Body
{
"_id": "36a1eb2b-06bd-426e-a3ce-e7ab609ea825",
"_name": "ABC Ltd",
"_description": "ABC Ltd",
"_userType": "external",
"_namespaces": [
"abcl_KQXXC4v5"
],
"_metadata": {
"_createdAt": 1707081965089,
"_updatedAt": 1707084681466,
"_createdById": "3259cd1a-a350-43fb-8447-9c21d2938fb7",
"_updatedById": "3259cd1a-a350-43fb-8447-9c21d2938fb7"
},
"_orgOwner": "251e73a2-1c91-400f-aa6f-8cfab6cc2a79",
"_shortName": "abc_ltd"
},
Edit Organization
Endpoint
PUT /passportsvc/api/v1/organizations/{id}
Request
Parameters
Path
| Parameter | Type | Description | Required |
|---|---|---|---|
id | String | The organization's id | Required |
Body
| Parameter | Type | Description | Required |
|---|---|---|---|
_name | Number | Pass a new name for the organization. | Required |
_description | Number | Pass a new description for the organization. | Optional |
_userType | String | Pass a new userType, which defines the organizationation's type. Use this label to identify resources of the same type. | Optional |
Code example
{
"_name": "ABC Ltd",
"_description": "ABC Ltd",
"_userType":"external"
}
Response
Codes
| Code | Description |
|---|---|
200 | Success |
400 | Bad Request |
404 | Not Found |
Body
{
"_id": "36a1eb2b-06bd-426e-a3ce-e7ab609ea825",
"_name": "ABC Ltd",
"_description": "ABC Ltd",
"_userType": "external",
"_namespaces": [
"abcl_KQXXC4v5"
],
"_metadata": {
"_createdAt": 1707081965089,
"_updatedAt": 1707084681466,
"_createdById": "3259cd1a-a350-43fb-8447-9c21d2938fb7",
"_updatedById": "3259cd1a-a350-43fb-8447-9c21d2938fb7"
},
"_orgOwner": "251e73a2-1c91-400f-aa6f-8cfab6cc2a79",
"_shortName": "abc_ltd"
},
Delete Organization
DELETE /passportsvc/api/v1/organizations/{id}
Request
Parameters
Path
| Parameter | Type | Description | Required |
|---|---|---|---|
id | String | The organization's id | Required |
Response
Codes
| Code | Description |
|---|---|
204 | No Content |
404 | Not Found |
Get Organization Users
This API call returns a list of all the users in a specified organization. Organization users are defined as either users in organization-level user groups or users in the user groups of the organization's applications.
The query should apply case insensitive wild card search on first name, last name and email.
Endpoint
GET /passportsvc/api/v1/organizations/:id/users
Request
Parameters
Query
| Parameter | Type | Description | Required |
|---|---|---|---|
query | String | Wild card search first name, last name and email (For ex: ?query=john) | Optional |
_offset | Number | Enter an offset value for the pagination response. | Optional |
_pageSize | Number | Enter a number for the ammount of applications you want to return per page. | Optional |
Response
Body
{
"_offset": 0,
"_pageSize": 2,
"_total": 2,
"_list": [
{
"_id": "be9ff9f4-ca6a-4c6e-a619-6786862a6b6a",
"_firstname": "john",
"_lastname": "doe",
"_eusa": false,
"_privacy": true,
"_email": "orgonwer@mailinator.com",
"_disabled": false
},
{
"_id": "ace9f9c8-6529-4338-9f63-30edf1aeb6bb",
"_firstname": "john",
"_lastname": "doe",
"_eusa": false,
"_privacy": true,
"_email": "appwoner2@mailinator.com",
"_disabled": false
}
]
}