Create a 3D View Exchange
This task will guide you through creating an exchange for the 3D views published on Autodesk Construction Cloud (ACC).
You will use the following mutation in this task:
Type | Operation | Description |
---|---|---|
Mutation | createExchange | Creates a data exchange. |
Step 1 - Create a 3D View Exchange
The following steps demonstrate how you can run the createExchange mutation to create an exchange for the 3D views that are published on ACC.
- Enter the following query in the Query Pane of the Data Exchange Explorer.
Query
mutation CreateExchange( $viewName: String $sourceFileId: String! $targetExchangeName: String! $targetFolderId: String! ) { createExchange( input: { viewName: $viewName source: { fileId: $sourceFileId } target: { name: $targetExchangeName, folderId: $targetFolderId } } ) { exchange { id name elements { results { id name } } } } } } }
Show More - In the Query Variables pane, enter the values for the following fields:
- viewName: The name of the 3D view that is published on ACC.
- sourceFileId: The item ID of the source file from which the exchange is being created.
- targetExchangeName: The name of the exchange to be created.
- targetFolderId: The ID of the target folder where the exchange will be stored.
Query Variables
{ "viewName": "FourWalls_3D", "sourceFileId": "aXRlbX5iLjc2OGNhZTE0LTc2YjMtNDUzMS05MDMwLTI1MjEyZGFiNGU0OH5iLjIyYTVkYzQ3LWNhMTktNDIzMS05ZjNlLTE1N2ViZDQ4NDJmZn51cm46YWRzay53aXBwcm9kOmZzLmZvbGRlcjpjby5ON21kU05TSFR3Nk81dWNualhsSjJRfnVybjphZHNrLndpcHByb2Q6ZG0ubGluZWFnZTpCVGJ3enVuSlFRU0wwTVBsbFhNVDZB", "targetExchangeName": "3D View Category Door Exchange", "targetFolderId": "Zm9sZH5iLjc2OGNhZTE0LTc2YjMtNDUzMS05MDMwLTI1MjEyZGFiNGU0OH5iLjIyYTVkYzQ3LWNhMTktNDIzMS05ZjNlLTE1N2ViZDQ4NDJmZn51cm46YWRzay53aXBwcm9kOmZzLmZvbGRlcjpjby5ON21kU05TSFR3Nk81dWNualhsSjJR" }
- Click Play. The exchange will be created and the response will look similar to the following code block.
Response
{ "data": { "createExchange": { "exchange": { "id": "ZXhjfnlwdWFzY1NicWlIT0R1R0s4OUkwTHdfTDJDfjY0MDJjMzFkLTg4Y2QtM2NjYy05MjY4LTE1ZmUyMmY0ODMwYg", "name": "3D View Category Door Exchange", "elements": { "results": [ ] } } } } }
Show More
The exchange has been created successfully; however, the result contains empty elements. This could be due to the exchange being in one of the these states: IN_PROGRESS, FAILED, or COMPLETED with no elements. Refer to ExchangeStatus page to learn more about the status of the exchange.
To check the status of the exchange, you can run the getExchangeCreationStatus query. For detailed instructions, refer to the procedure outlined in the next step.
Step 2 - Get Exchange Status
The following steps demonstrate how you can run the getExchangeCreationStatus query to check the status of the exchange that was created in the previous step.
- Enter the following query in the Query Pane of the Data Exchange Explorer.
Query
query GetExchangeStatus($exchangeId: ID!) { getExchangeCreationStatus(exchangeId: $exchangeId) { status versionNumber exchange { id name elements { results { id name } } } } }
Show More - In the Query Variables pane, enter the value of the exchangeId field.
Query Variables
{ "exchangeId": "ZXhjfnlwdWFzY1NicWlIT0R1R0s4OUkwTHdfTDJDfjY0MDJjMzFkLTg4Y2QtM2NjYy05MjY4LTE1ZmUyMmY0ODMwYg" }
- Click Play. The response will look similar to the following code block.
Response
{ "data":{ "getExchangeCreationStatus":{ "status":"COMPLETED", "versionNumber":1, "exchange":{ "id":"ZXhjfnlwdWFzY1NicWlIT0R1R0s4OUkwTHdfTDJDfjY0MDJjMzFkLTg4Y2QtM2NjYy05MjY4LTE1ZmUyMmY0ODMwYg", "name":"3D View Category Door Exchange", "elements":{ "results":[ { "id":"6CD2C9602D7D8878069B4F2A52431C4F82F942D3", "name":"Level 1" }, { "id":"4E549A13B43C6698D49E44C72A2002217EC1CA0B", "name":"36\" x 84\"" }, { "id":"E700279D3C18E48406E9369085BF3A3D639C3575", "name":"New Construction" }, { "id":"383416EBE8CA1023DEB787FF1886B4095FE7448E", "name":"Generic - 8\"" }, { "id":"43C60B40ACC07FE80F4CED8E42B42B9FABA1E753", "name":"Generic - 8\"" }, { "id":"FD7385C347BB2C0DE64AD0EABEF420DC43F7F94D", "name":"Generic - 8\"" }, { "id":"F0DEC8FFB03C0D775D751A7AFB7497A020E5DBC8", "name":"36\" x 48\"" }, { "id":"627E20C02DB930726F6BCADAB32FEE60037D0271", "name":"Level 2" }, { "id":"F93A3A5F62A17F598FD8B3CCD18A291962044C1C", "name":"Grid Line 1/2\"" }, { "id":"EC133AE7A42CA82A4CB7F6F643F722B7DD514F03", "name":"Generic - 8\"" } ] } } } } }
Show More
The exchange status is COMPLETED. To retrieve exchange-related information, follow the steps in Task 4 – Get Exchange, or refer to tasks under Advanced Queries.
If the status is IN_PROGRESS, wait for the exchange to complete and then follow the same steps to retrieve the information.