Request

Response

    GraphQL Endpoint
    POST

    mfg/v3/graphql/public

    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.
    Accept-Language
    string
    Sets your preferred language and locale for fields that support localization. When specified, supported fields will be returned in the specified language. For example, the localizedName and description fields of PropertyDefinition objects. Localized content is returned only when translations are available. Possible values:
    • zh-CN - Chinese (China)
    • zh-TW - Chinese (Taiwan)
    • cs-CZ - Czech (Czech Republic)
    • en-US - (Default) English (United States)
    • fr-FR - French (France)
    • de-DE - German (Germany)
    • it-IT - Italian (Italy)
    • ja-JP - Japanese (Japan)
    • ko-KR - Korean (South Korea)
    • pl-PL - Polish (Poland)
    • pt-BR - Portuguese (Brazil)
    • ru-RU - Russian (Russia)
    • es-ES - Spanish (Spain)
    • tr-TR - Turkish (Turkey)

    See Support for Localization in the Developer’s Guide for more information.

    * Required

    Request

    Body Structure

    query*
    object
    Contains the GraphQL query or mutation to send to the Manufacturing Data Model service.
    variables
    object
    Contains key-value pairs for GraphQL variables. Keys correspond to variable names defined in your query. Values represent the actual values for 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/v3/graphql/public' \
    -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/v3/graphql/public',
    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