Retrieve Projects
This topic provides instructions on how to retrieve the Projects available within a hub.
You will use the following query in this topic:
Type | Operation | Description |
---|---|---|
Query | projects | Retrieves projects available within a specified hub. |
Step 1 - 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.
- 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 MoreNote:
__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. - In the Query Variables Pane, enter the value of the
hubId
. To know how to obtain thehubId
, refer to Retrieve Hubs.Query Variables
{ "hubId": "urn:adsk.ace:prod.scope:42db5214-7dfe-431a-8275-2ea47d5686d5" }
- 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
Once the query runs successfully, your explorer should resemble the following image: