Request

Response

    Retrieve Projects

    This topic provides instructions on how to retrieve the Projects available within a hub.

    You will use the following operation in this topic:

    TypeOperationDescription
    Query projects Retrieves projects available within a specified hub.

    Request Projects Available within a Hub

    The following steps demonstrate how you can run the projects query to retrieve all the Projects that are available within a hub.

    1. Enter the following query in the Query Pane of the Manufacturing Data Model Explorer.

      Query

      query GetProjects($hubId: ID!, $filter: ProjectFilterInput) {
         projects(hubId: $hubId, filter: $filter) {
            results {
               id
               name
               __typename
               alternativeIdentifiers{
                  dataManagementAPIProjectId
               }
            }
         }
      }
      
      Show More

    Note: __typename in GraphQL is very useful tool for managing and using data, especially with polymorphic types (where an object can be one of several types). It helps you identify the type of objects returned by the server, making it easier to work with complex schemas and improve client-side caching.

    1. In the Query Variables Pane, enter the value of the hubId. To know how to obtain the hubId, refer to Retrieve Hubs.

      Query Variables

      {
         "hubId": "urn:adsk.ace:prod.scope:42db5214-7dfe-431a-8275-2ea47d5686d5"
      }
      
    2. Click Play. A list of projects available within a hub is displayed in the response.

      Response

      {
         "data": {
            "projects": {
               "results": [
                  {
                     "id": "urn:adsk.workspace:prod.project:b2b09d83-bb02-47d4-a717-8ed07e497663",
                     "name": "Assets",
                     "__typename": "Project",
                     "alternativeIdentifiers": {
                        "dataManagementAPIProjectId": "a.YnVzaW5lc3M6YXV0b2Rlc2s2MTA0I0QyMDIyMDIwMjQ5MjcyOTcwNg"
                     }
                  },
                  {
                     "id": "urn:adsk.workspace:prod.project:1e5ae8b2-81c3-458c-861c-7f5e64856efd",
                     "name": "GRAPHQL-FUNCTIONAL-TESTS",
                     "__typename": "Project",
                     "alternativeIdentifiers": {
                        "dataManagementAPIProjectId": "a.YnVzaW5lc3M6YXV0b2Rlc2s2MTA0I0QyMDIyMDIwMjQ5MjcyNTIzMQ"
                     }
                  },
                  {
                     "id": "urn:adsk.workspace:prod.project:f4a87c53-edc3-4bb0-b72e-12b282e57df4",
                     "name": "TestComplexDesign",
                     "__typename": "Project",
                     "alternativeIdentifiers": {
                        "dataManagementAPIProjectId": "a.YnVzaW5lc3M6YXV0b2Rlc2s2MTA0IzIwMjMwNzA2NjUzMzY2MjMx"
                     }
                  }
               ]
            }
         }
      }
      
      Show More