curl --request POST \
--url https://{cluster}.cognitedata.com/api/v1/projects/{project}/context/diagram/convert \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"items": [
{
"fileId": 1234,
"annotations": [
{
"text": "21-PT-1019",
"region": {
"shape": "rectangle",
"vertices": [
{
"x": 0.58,
"y": 0.12
}
],
"page": 1
},
"confidence": 0.5,
"entities": [
{
"userDefinedField": "21PT1017",
"ignoredField": "AA11"
},
{
"userDefinedField": [
"21PT1017-A",
"21PT1017-B"
]
}
]
}
]
}
],
"grayscale": true
}
'{
"items": [
{
"fileId": 1234
}
],
"jobId": 123,
"status": "Queued",
"createdTime": 1730204346000,
"startTime": 1730204346000,
"statusTime": 1730204346000,
"errorMessage": null,
"grayscale": true
}Required capabilities:
assetsAcl:READfilesAcl:READ
Convert interactive engineering diagrams to image format, with highlighted annotations. Supported input file mime_types are application/pdf, image/jpeg, image/png, image/tiff. Supported output image formats are PNG and SVG, only the svg embeds the input annotations.
curl --request POST \
--url https://{cluster}.cognitedata.com/api/v1/projects/{project}/context/diagram/convert \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"items": [
{
"fileId": 1234,
"annotations": [
{
"text": "21-PT-1019",
"region": {
"shape": "rectangle",
"vertices": [
{
"x": 0.58,
"y": 0.12
}
],
"page": 1
},
"confidence": 0.5,
"entities": [
{
"userDefinedField": "21PT1017",
"ignoredField": "AA11"
},
{
"userDefinedField": [
"21PT1017-A",
"21PT1017-B"
]
}
]
}
]
}
],
"grayscale": true
}
'{
"items": [
{
"fileId": 1234
}
],
"jobId": 123,
"status": "Queued",
"createdTime": 1730204346000,
"startTime": 1730204346000,
"statusTime": 1730204346000,
"errorMessage": null,
"grayscale": true
}Access token issued by the CDF project's configured identity provider. Access token must be an OpenID Connect token, and the project must be configured to accept OpenID Connect tokens. Use a header key of 'Authorization' with a value of 'Bearer $accesstoken'. The token can be obtained through any flow supported by the identity provider.
An array of files and annotations to create interactive diagrams.
1 - 50 elementsAn object containing file (external/instance) id. The file can have at most 50 pages.
Show child attributes
Return the SVG version in grayscale colors only (reduces the file size).
true
Success
An object containing file (external/instance) id. The file can have at most 50 pages.
Show child attributes
Contextualization job ID.
123
The status of the job.
Queued, Running, Completed, Failed The number of milliseconds since 00:00:00 Thursday, 1 January 1970, Coordinated Universal Time (UTC), minus leap seconds.
x >= 01730204346000
The number of milliseconds since 00:00:00 Thursday, 1 January 1970, Coordinated Universal Time (UTC), minus leap seconds.
x >= 01730204346000
The number of milliseconds since 00:00:00 Thursday, 1 January 1970, Coordinated Universal Time (UTC), minus leap seconds.
x >= 01730204346000
If the job failed, some more information about the error cause.
null
Return the SVG version in grayscale colors only (reduces the file size).
true
Was this page helpful?