Request

Response

    GraphQL Endpoint
    POST

    mfg/graphql

    Sends GraphQL requests to the Manufacturing Data Model GraphQL service and returns responses in the JSON format.

    Resource Information

    Method and URI
    Authentication Context
    user context required
    Required OAuth Scopes
    data:create data:read data:write data:search
    Data Format
    JSON

    Request

    Headers

    Authorization*
    string
    Must be Bearer <TOKEN>, where <TOKEN> is an access token obtained by a three-legged OAuth flow.
    Content-Type
    string
    Must be application/json.
    * Required

    Request

    Body Structure

    query*
    object
    Contains the GraphQL query or mutation to send to the Manufacturing Data Model service.
    variables
    object
    Contains a set of key-value pairs, where the keys correspond to the names of the variables defined in your GraphQL query, and the values represent the values of those variables.
    * Required

    Example 1

    This example demonstrates how to use cURL to send a GraphQL query to the Manufacturing Data Model service.

    Request

    curl -v 'https://developer.api.autodesk.com/mfg/graphql' \
    -X 'POST' \
    -H 'Authorization: Bearer AuIPTf4KYLTYGVnOHQ0cuolwCW2a...' \
    -H 'Content-Type: application/json' \
    -d ' {
       "query": "query projects($hubId: ID!) {
           projects(hubId: $hubId) {
              results {
                 id
                 name
              }
          }
       }",
       "variables": {
          "hubId": "a.YnVzaW5lc3M6YXV0b2Rlc2syMDA2"
       }
    }'
    
    Show More

    Response

    {
    "data": {
       "projects": {
          "results": [{
             "id": "a.YnVzaW5lc3M6YXV0b2Rlc2syMDM5I0QyMDIyMDEzMTUwMzg3NDE5",
             "name": "Default Project"
          },
          {
             "id": "a.YnVzaW5lc3M6YXV0b2Rlc2syMDM5I0QyMDIyMDEzMTUwMzg3NDQ0",
             "name": "Admin Project"
          },
          {
             "id": "a.YnVzaW5lc3M6YXV0b2Rlc2syMDM5I0QyMDIyMDEzMTUwMzg3NDY5",
             "name": "Assets"
          }]
        }
     }
    }
    
    Show More

    Example 2

    This example demonstrates how to use Axios in JavaScript to send a GraphQL query to the Manufacturing Data Model service.

    Request

    axios({
    method: 'POST',
    url: 'https://developer.api.autodesk.com/mfg/graphql',
    data: {
      query hubs: `{
        hubs {
          results {
            name
          }
      }`
      }
    })
    
    Show More

    Note: Axios automatically sets the Content-Type header to application/json.

    Response

    {
    ""data":{
       "hubs":{
          "results":[
             {
                "id":"a.YnVzaW5lc3M6YXV0b2Rlc2syMDA2",
                "name"":""L2-Forge-Data-Team"
             },
             {
                "id":"a.YnVzaW5lc3M6YXV0b2Rlc2s0NTA5",
                "name"":""Michelangelo’s Playground"
             }
          ]
       }
    }
    }
    
    Show More