Assignment to organizations
Use the following endpoints to manage the assignment of root assemblies to sub-organizations:
Creating assignments of assemblies to sub-organizations
POST /1/catalog/assignments/organizations
Multiple assemblies can be assigned to organizations in one call by specifying a list of assignments. Assignments are defined as pairs of assembly id and organization id.
The endpoint returns a list of indices of assignments, which have been created
.
The result contains also an error
dictionary in case some assignments could not be created with corresponding error descriptions.
Assignments that already exist will be ignored.
Only root assemblies can be assigned to sub-organizations.
Assemblies are always part of the main-organization. This means that explicit assignments of assemblies to the root-organization will fail.
This endpoint will respond with error code 503 when the catalog API is in maintenance mode.
Each assignment in the list contains:
Parameter | Value |
---|---|
ass_id | Unique id of the assembly to be assigned to an sub-organization |
org_id | Unique id of the sub-organization to which the assembly should be assigned |
🡢 See API Reference
- HTTP
- Python
- JavaScript
> POST https://api.partium.io/1/catalog/assignments/organizations
> Authorization: Bearer <<Your Access Token or API Key>>
> Content-Type: application/json
>
> [
> {
> "ass_id": "root-ass1",
> "org_id": "sub-org1"
> },
> {
> "ass_id": "root-ass1",
> "org_id": "sub-org2"
> },
> {
> "ass_id": "root-ass2",
> "org_id": "sub-org2"
> }
> ]
>
< HTTP/1.1 200 OK
< Content-Type: application/json
<
< {
< "created": [0,1,2],
< "errors": {}
< }
response = requests.post(
'https://api.partium.io/1/catalog/assignments/organizations',
headers={
'Authorization': 'Bearer <<Your Access Token or API Key>>',
},
json=[
{
"ass_id": "root-ass1",
"org_id": "sub-org1"
},
{
"ass_id": "root-ass1",
"org_id": "sub-org2"
},
{
"ass_id": "root-ass2",
"org_id": "sub-org2"
}
]
)
fetch('https://api.partium.io/1/catalog/assignments/organizations', {
method: 'POST',
headers: {
Authorization: 'Bearer <<Your Access Token or API Key>>',
},
body: [
{
"ass_id": "root-ass1",
"org_id": "sub-org1"
},
{
"ass_id": "root-ass1",
"org_id": "sub-org2"
},
{
"ass_id": "root-ass2",
"org_id": "sub-org2"
}
]
}).then(res => {
...
});
Replace <<Your Access Token or API Key>>
with the preferred authentication method. See Authentication.
Removing assignments of assemblies to sub-organizations
DELETE /1/catalog/assignments/organizations
Multiple assemblies can be removed from sub-organizations in one call by specifying a list of assignments. Assignments are defined as pairs of assembly id and organization id.
The endpoint does not return information about deleted entities. Assignments that do not exist will be silently ignored.
Each entry in the list of assignments to remove contains:
Parameter | Value |
---|---|
ass_id | Unique id of the assembly to be removed from an sub-organization |
org_id | Unique id of the sub-organization from which the assembly should be removed |
This endpoint will respond with error code 503 when the catalog API is in maintenance mode.
🡢 See API Reference
- HTTP
- Python
- JavaScript
> DELETE https://api.partium.io/1/catalog/assignments/organizations
> Authorization: Bearer <<Your Access Token or API Key>>
> Content-Type: application/json
>
> [
> {
> "ass_id": "root-ass1",
> "org_id": "sub-org1"
> },
> {
> "ass_id": "root-ass2",
> "org_id": "sub-org1"
> }
> ]
>
< HTTP/1.1 200 OK
< Content-Type: application/json
<
< {}
response = requests.delete(
'https://api.partium.io/1/catalog/assignments/organizations',
headers={
'Authorization': 'Bearer <<Your Access Token or API Key>>',
},
json=[
{
"ass_id": "root-ass1",
"org_id": "sub-org1"
},
{
"ass_id": "root-ass2",
"org_id": "sub-org1"
}
]
)
fetch('https://api.partium.io/1/catalog/assignments/organizations', {
method: 'DELETE',
headers: {
Authorization: 'Bearer <<Your Access Token or API Key>>',
},
body: [
{
"ass_id": "root-ass1",
"org_id": "sub-org1"
},
{
"ass_id": "root-ass2",
"org_id": "sub-org1"
}
]
}).then(res => {
...
});
Replace <<Your Access Token or API Key>>
with the preferred authentication method. See Authentication.
Listing assignments of assemblies to sub-organizations
POST /1/catalog/assignments/organizations/list
Query a list of assignments of assemblies to sub-organizations.
The list can be filtered by specifying a list of ass_ids
and a list of org_ids
.
A paging mechanism can be used to fetch more data if the number of results exceeds the paging limit
.
Parameter | Value |
---|---|
query.ass_ids | Optional list of assembly ids. If specified, only assignments of the specified assemblies are part of the result |
query.org_ids | Optional list of organization ids. If specified, only assignments to the specified sub-organizations are included in the result |
paging.limit | Maximum number of results returned by the endpoint |
paging.last_object_id | Use this id to get the next page of results. The id is returned by a previous call to this endpoint |
🡢 See API Reference
Assemblies are always part of the main organization. Therefore, the result does not contain explicit assignments to the main organization.
Only root assemblies can be assigned to sub-organizations. Sub-assemblies are then automatically part of the sub-organizations too. This means that the resulting list of assignments will not contain any sub-assemblies.
- HTTP
- Python
- JavaScript
> POST https://api.partium.io/1/catalog/assignments/organizations/list
> Authorization: Bearer <<Your Access Token or API Key>>
> Content-Type: application/json
>
> {
> "query": {
> "ass_ids": ["root-ass1", "root-ass2"]
> },
> "paging": {
> "limit": 10
> }
> }
>
< HTTP/1.1 200 OK
< Content-Type: application/json
<
< {
< "result": [
< {
< "ass_id": "root-ass1"
< "org_id": "sub-org1",
< },
< {
< "ass_id": "root-ass1"
< "org_id": "sub-org2",
< },
< {
< "ass_id": "root-ass2"
< "org_id": "sub-org2",
< }
< ],
< "last_object_id": "unique_object_id",
< "more_data": false
< }
response = requests.post(
'https://api.partium.io/1/catalog/assignments/organizations/list',
headers={
'Authorization': 'Bearer <<Your Access Token or API Key>>',
},
json={
"query": {
"ass_ids": ["root-ass1", "root-ass2"]
},
"paging": {
"limit": 10
}
}
)
fetch('https://api.partium.io/1/catalog/assignments/organizations/list', {
method: 'POST',
headers: {
Authorization: 'Bearer <<Your Access Token or API Key>>',
},
body: {
"query": {
"ass_ids": ["root-ass1", "root-ass2"]
},
"paging": {
"limit": 10
}
}
}).then(res => {
...
});
Replace <<Your Access Token or API Key>>
with the preferred authentication method. See Authentication.
more_data
in the response is true
indicates that there are more results to fetch.
In that case use the returned last_object_id
as a parameter for the next call to fetch the next page of results. Repeat this until more_data
is false
.