HxDR GraphQL API
GraphQL is a query language for your API, and a server-side runtime for executing queries using a type system you define for your data. GraphQL isn’t tied to any specific database or storage engine and is instead backed by your existing code and data.
A GraphQL service is created by defining types and fields on those types, then providing functions for each field on each type. After a GraphQL service is running (typically at a URL on a web service), it can receive GraphQL queries to validate and execute. The service first checks a query to ensure it only refers to the types and fields defined, and then runs the provided functions to produce a result.
GraphQL Header
The server can use that header to authenticate the user and attach it to the GraphQL execution context, so resolvers can modify their behavior based on a user's role and permissions.
GraphQL Variables
Variables can be used to create dynamic queries and mutations, as they allow you to pass dynamic values as a separate dictionary. In other words, variables in GraphQL are passed like arguments to a function allowing said arguments to be extracted as variables from queries and mutations, simplifying them.
HxDR GraphQL playground for platform users:
Goto HxDR graphql playground, explore the schema, queries and mutations.
Put you access token under Headers for each request.
{
"authorization": "Bearer eyJz9sdfsdfsdfsd..............."
}
Provide all the required variable values in the query or under Variables
query Asset($id: ID!) {
asset(groupedAssetId: $id) {
... on GroupedAssetOutput {
id
sharingCode
}
}
}
{
"id": "14f8559c-dae6-4468-b258-33c8556adc44"
}
OR
query Asset {
asset(groupedAssetId: "14f8559c-dae6-4468-b258-33c8556adc44") {
... on GroupedAssetOutput {
id
sharingCode
assetStatus
downloadLink
}
}
}
Include the needed Fragments, Types and fields in your query.
query GetAsset {
getAsset(groupedAssetId: "14f8559c-dae6-4468-b258-33c8556adc44") {
... on GroupedAssetOutput {
id
assetType
asset {
id
groupedAssetId
artifactsV2 {
parentId
contents {
id
groupedAssetId
addresses {
parentId
contents {
... on AddressOgc3DOutput {
id
endpoint
}
}
}
}
}
}
}
}
}
Execute the query and parse the response as needed.
{
"data": {
"getAsset": {
"id": "14f8559c-dae6-4468-b258-33c8556adc44",
"assetType": "OBJ_UPLOAD",
"asset": {
"id": "e18bc4ff-beca-42c5-9ba3-7bc38bda3532",
"groupedAssetId": "14f8559c-dae6-4468-b258-33c8556adc44",
"artifactsV2": {
"parentId": "e18bc4ff-beca-42c5-9ba3-7bc38bda3532",
"contents": [
{
"id": "47e72ef3-ec20-4b54-9cf5-b1355769a441",
"groupedAssetId": "14f8559c-dae6-4468-b258-33c8556adc44",
"addresses": {
"parentId": "47e72ef3-ec20-4b54-9cf5-b1355769a441",
"contents": [
{
"id": "391f6935-6a51-4ad3-bc1b-21d02de74cd0",
"endpoint": "/files/assets/e18bc4ff-beca-42c5-9ba3-7bc38bda3532/artifacts/47e72ef3-ec20-4b54-9cf5-b1355769a441/MESH/OGC3D_TILES/tileset.json?signature=gtetu8Lulbq4z-oWBemVdxnx3vyASsQVhrKeYXnQdz9rSZQsDHQFEFRzKyk3qPHAGm-NkamDGNDmtJKsQuyTxEw_3PM8tuvMzg-1GWFqTYapVI-wW62LwZHK_iDtP_PpZCCCaqfWtMMwyA-FhuRhCCW4jVAgYqCR1ZNzJpNK_SgEIr_mkiaTS2jIg6shcWoxxRC_C-0C2TJFz1Ro9IdUIfV_Sgh4CKt9-urPUDEv5TZ0qPjwKV5GYlwzisMLDZDJOFRxGNs_S-5Mqtzu4XNMYeq5mHgox40R--42yJkIKemEgCmaRxeWkpflvgQhzmv5WdameJS5zMxRjHCoNA3Z4UMQHR92bkt9Ybk-bVXLrfVZkt2YRu0RiFb_26ZIO5dQ6bo9mQbVc1NEagXlOBv9Hdn73E72JtEVdQAppdrICqZRHTXLURh4SGIKGwa2YNg8PySXE4bSgzVjYPfYiQxb9ZDNlWS6_CCb_ihXQduNEmapuuuYNCTmKhdHGmvGdy5wvHvq2XaM4CFZNuOjPINd4mqU-DchycO9iz5gmZlnFHvQgGne8UisQLCSu6yg17hzgtEuZA9Dmojgvmy_B9dJNXgf696l3tMC6nfiVdSve8tsE5TdiywCa24iXV0JAgzx3T932iKXGWrNk3VMTGnIalz9hTi5pGMih_ZfaUIYJfvAGQEyN1kvBx9hlx0lNyf8dc17x4DDry0jKVG_sRzGwg=="
}
]
}
}
]
}
}
}
}
}
Hint: Adding GraphQL Network Inspector (opens in a new tab) to your browser (Edge/Chrome) will allow you to copy paste queries/mutations
Message to our integrators
we would like to put your attention to GraphQL Inspector (opens in a new tab) adding this tool to your CI/CD will help you to immediately get the information once we announce deprecation of a query or mutation you are using. this will allow you to plan the needed work to catch up with the latest version of that particular query/mutation.
Deprecation period is defined to a maximum of two years for now depending on the query/mutation. thanks to improved update mechanisms we are hopeful to reduce that time in the soon future.
Message to the developers managing the HxDR API integration
We would like to improve the logging of API usage and need your help. While we are capable of monitoring every single GraphQL query and mutation, we are not (yet) able to log the client and client version making those requests. This would be especially helpful when deprecating parts of the API. We already check usage of those queries/muatations before shutting them down. Knowing the clients that are still using those queries/mutations we can communicate with the corresponding dev-teams directly and find a solution before terminating a query/mutation. We will also be able to provide you with usage metrics for your client if needed.
In order to do so, we kindly ask you to add the following request headers to all GraphQL HTTP requests:
- x-graphql-client-name : A readable name identifying the application or team that is making the request. For example "reality-cloud-studio".
- x-graphql-client-version : An optional version information string in an arbitrary format. For example: "7.2.5".
In case you are using Xalt Edge, there will be a separate communication from the corresponding team how this option will be made available on the SDK.
You can quickly learn GraphQL, explore schema and try queries using tools such as:
GraphQL Libraries
To successfully execute a request on HxDR GraphQL playground, See following :
JS-SDK reference
Schema
Platform API schema base types