Request

Response

    Authentication

    The M&E Data Model API uses Three-Legged OAuth (3LO) for authentication. This means that you need to obtain a client-and-user specific access token to make requests to the API. The access token is obtained through a series of steps that involve redirecting the user to a login page, where they can authorize your application to access their data.

    1. Create a user account at https://accounts.autodesk.com/register.
    2. Once created, log in with your new account and create a new web application at https://aps.autodesk.com.

      1. Select “Traditional Web App” as the application type, and give it a name.
      2. Under “API Access”, ensure that “M&E Data Model API” is selected.
    3. Make a request to https://developer.api.autodesk.com/authentication/v2/authorize to obtain an auth token. This request should include the following parameters:

      • client_id: The client ID of your application.
      • response_type: Set to code.
      • redirect_uri: The URL to which the user will be redirected after authorization. Note that this URL must match the one you specified when creating your application.
      • scope: Set to openid+data%3Acreate+data%3Aread+data%3Awrite.

      For example:

      https://developer.api.autodesk.com/authentication/v2/authorize?client_id=<YOUR_APPLICATION_CLIENT_ID>&response_type=code&redirect_uri=http%3A%2F%2Flocalhost%3A8080%2F&scope=openid+data%3Acreate+data%3Aread+data%3Awrite
      
    4. Then you are redirected to the login page, where you can log in and authorize your application.

    5. Make a request to https://developer.api.autodesk.com/authentication/v2/token to get a three-legged OAuth (3LO) token. For example:

      curl --request POST \
      --url https://developer.api.autodesk.com/authentication/v2/token \
      --header 'Accept: application/json' \
      --header 'Content-Type: application/x-www-form-urlencoded' \
      --header 'region: ' \
      --data grant_type=authorization_code \
      --data code=<YOUR_AUTHENTICATION_CODE> \
      --data redirect_uri=http://localhost:8080/ \
      --data scope=openid+data:create+data:read+data:write \
      --data client_id=<YOUR_APPLICATION_CLIENT_ID> \
      --data client_secret=<YOUR_APPLICATION_CLIENT_SECRET>
      
      Show More
    6. The response will contain the access token and a refresh token:

      {
          "access_token": "<YOUR_3LO_ACCESS_TOKEN>",
          "token_type": "Bearer",
          "expires_in": 3659,
          "refresh_token": "<YOUR_REFRESH_TOKEN>"
      }
      
    7. You can now make a request directly to the M&E Data Model API using the access token. Include the access token in the Authorization header of your request, like this:

      curl --request POST \
      --url 'https://developer.api.autodesk.com/flow/data/v1/graphql' \
      --header 'Authorization: Bearer <YOUR_3LO_ACCESS_TOKEN>' \
      --header 'Content-Type: application/json' \
      --data '{
        "query": "query Collections($input: GetCollectionsInput) {
          collections(input: $input) {
            ... on CollectionsResponse {
              data {
                id
              }
            }
          }
        }",
        "variables": {
          "input": {
            "pagination": {
              "limit": 10
            }
          }
        }
      }'
      
      Show More