Skip to navigation

Task 2 - Create and fetch an Organization

View as Markdown

Task 2 - Create an Organization

An organization typically represents a real-world organization. It is a container of all the groups, libraries, and schemas of that organization. So, in this step you create an organization to hold all the schemas that you will create for this tutorial.

You do not need any special privileges to create an organization. Every organization you create is private by default. You will have admin privileges to the organization; and groups, libraries, and schemas within that organization.

Expected task outcome

By the end of this task you will be able to:

  • Create a new organization.
  • Fetch details of organization.

Endpoints used in this task

You will use the following API endpoints in this task:

.. list-table:: :widths: 10, 50, 40 :header-rows: 1

    • Method
    • Endpoint
    • Operation
    • POST
    • /organizations
    • Create an Organization_
    • GET
    • /organizations/{organizationId}
    • Fetch an Organization_

Step 1 - Create a Organization

In Postman, on the sidebar, Select Task 2 > POST Create a Organization and click Send. The equivalent cURL request is as follows.

Note: You can retrieve the resource information of a tenant using the requested tenant ID in a two-legged context Get tenantId.

Request

curl -X POST \
'https://developer-stg.api.autodesk.com/schema/v3/organizations' \
-H 'Authorization: Bearer <YOUR_ACCERSS_TOKEN>' \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
-D '{
"name": "<ORGANIZATION_ID>",
"tenantId": "<TENANT_ID>",
"title": "<ORGANIZATION_TITLE>",
"description": "<ORGANIZATION DESCRIPTION>"
}

|

Response

{
"name": "<ORGANIZATION_ID>",
"title": "<ORGANIZATION_TITLE>",
"tenantId": "<TENANT_ID>",
"description": "<ORGANIZATION DESCRIPTION>",
"createdBy": "zXIoQYTOAeEHvO1wafII0yjraOYfPnN4",
"createTime": "2022-07-20T08:26:25Z",
"lastModifiedBy": "SMS4QCDNNDMB",
"lastModifiedTime": "2022-08-11T03:01:11Z"
}

Step 2 - Fetch Organization

This topic explains how to fetch the details of a specific organization and the permission you have been granted.

In postman, Select Task 2 > GET Fetch Organization and click Send. The equivalent cURL request is as follows.

Request

curl -X GET \
'https://developer-stg.api.autodesk.com/schema/v3/organizations/<ORGANIZATION_ID>' \
-H 'Authorization: Bearer eyJhbGciOiJSUzI1NiIsImtpZCI6...' \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \

|

Response

{
"name": "<ORGANIZATION_ID>",
"title": "<ORGANIZATION_TITLE>",
"tenantId": "<TENANT_ID>",
"description": "<ORGANIZATION_DESCRIPTION>",
"userData": {
"additionalProp1": "string",
"additionalProp2": "string",
"additionalProp3": "string"
},
"permissions": [
{
"Id": "read",
"Effect": "Allow",
"Subjects": {
"Service": [
"AYK3q05maQE8bVpTG2sTnYwPj0Jn6f8J"
]
},
"Action": "read"
},
{
"Id": "admin",
"Effect": "Allow",
"Subjects": {
"Service": [
"AYK3q05maQE8bVpTG2sTnYwPj0Jn6f8J"
]
},
"Action": "admin"
},
{
"Id": "write",
"Effect": "Allow",
"Subjects": {
"Service": [
"AYK3q05maQE8bVpTG2sTnYwPj0Jn6f8J"
]
},
"Action": "write"
},
{
"Id": "delete",
"Effect": "Allow",
"Subjects": {
"Service": [
"AYK3q05maQE8bVpTG2sTnYwPj0Jn6f8J"
]
},
"Action": "delete"
}
],
"createdBy": "AYK3q05maQE8bVpTG2sTnYwPj0Jn6f8J",
"createTime": "2022-07-29T11:43:24Z",
"lastModifiedBy": "AYK3q05maQE8bVpTG2sTnYwPj0Jn6f8J",
"lastModifiedTime": "2022-08-01T04:39:14Z"
}