colormass Docs
Github Examplescolormass.com
Development
Development
  • Welcome
  • Configurator
    • Introduction
    • Web Components
      • Getting Started
      • Advanced Integration
      • Styling
      • Setting Parameters
      • SDK API Reference
      • Examples
        • Custom Menu
        • Overlay Material Color
    • Iframe Integration
      • Getting Started
      • Advanced Integration
      • API Reference
        • Default Configurations
  • Data Exporter
    • Generating Exports
    • Integration
    • API Access
Powered by GitBook
On this page
  1. Data Exporter

API Access

PreviousIntegration

Last updated 7 months ago

The colormass API is available at

Authentication

In the Headers tab, enter the demo API key to authenticate to the backend:

{
 "X-Api-Key": "0ecff5f6-5b65-42bf-84d1-facf9ed37c7avf"
}

The following query will return download URLs for thumbnails/tileable images:

query GetMaterialDownloadLink($articleId: String!, $organizationId: ID!, $assignmentType: DataObjectAssignmentType!, $resolution: DownloadResolution, $fileType: DownloadFileType) {
  materials(filter: {articleId: {equals: $articleId}, organizationId: {equals: $organizationId}}) {
    dataObjectAssignments(filter: {assignmentType: [$assignmentType]}) {
      dataObject {
        downloadUrl(resolution: $resolution, fileType: $fileType)
        mediaType
      }
    }
  }
}

For PBR maps, use this query:

query GetPbrMaterialDownloadLink($articleId: ID!, $organizationId: String!, $resolution: DownloadResolution, $fileType: DownloadFileType) {
  materials(filter: {articleId: {equals: $articleId}, organizationId: {equals: $organizationId}}) {
    jsonFileAssignments(filter: {jsonFileContent: [{resolution: $resolution, fileType: $fileType, state: "done", default: true}]}) {
      jsonFile {
        outputDataObject {
          downloadUrl
        }
      }
    }
  }
}
{
 "organizationId": "<your organization id>",
 "articleId": "<article id>",
 "resolution": "High",
 "fileType": "exr",
 "assignmentType": "MaterialThumbnail_20x20"
}

The required link is the downloadUrl field of the first dataObject of the first dataObjectAsssignment returned, unless additional filter criteria apply (for example, you might want to filter by mediaType to exclude zip files and only offer download links to images).

Follow to try the queries on live data. You will need to provide variables in this format:

https://gql.colormass.com/graphql
this link