Welcome to the Onshape forum! Ask questions and join in the discussions about everything Onshape.
First time visiting? Here are some places to start:- Looking for a certain topic? Check out the categories filter or use Search (upper right).
- Need support? Ask a question to our Community Support category.
- Please submit support tickets for bugs but you can request improvements in the Product Feedback category.
- Be respectful, on topic and if you see a problem, Flag it.
If you would like to contact our Community Manager personally, feel free to send a private message or an email.
Drawing´s element modification through API endpoint and JSON-request (onshapedrawingjson)
Hi all,
I try make changes into drawing´s note through API, but something goes wrong.
At first was created blank drawing with POST (/drawings/d/{did}/w/{wid}/create) and JSON request:
{
"border": true,
"computeIntersection": false,
"decimalSeparator": "PERIOD",
"drawingName": "API test drawing"
}
Then added a note with POST (/drawings/d/{did}/w/{wid}/e/{eid}/modify) and JSON request:
{
"description": "API test",
"jsonRequests": [
{
"formatVersion": "2021-01-01",
"messageName": "OnshapeCreateAnnotations",
"annotations": [
{
"type": "Onshape::Note",
"note": {
"position": {
"type": "Onshape::Reference::Point",
"coordinate": [
3,
4,
0
]
},
"contents": "NOTE",
"textHeight": 0.4,
"logicalId": "note1"
}
}
]
}
]
}
Working fine and representation in JSON (POST translation /drawings/d/{did}/{wv}/{wvid}/e/{eid}/translations with JSON-request { "formatName": “DRAWING_JSON"} )seem fine:
{"sheets":[{"active":true,"annotations":[{"note":{"contents":"NOTE","logicalId":"h:100000D4","position":{"coordinate":[2.0,4.0,0.0],"type":"Onshape::Reference::Point"},"textHeight":0.4},"type":"Onshape::Note"}],"format":"","index":1.0,"name":"Sheet1","reference":"","scale":{"denumerator":1.0,"numerator":0.0},"size":"","views":[]}]}
At next try modify contains of note from “NOTE” to “MESSAGE” within POST (/drawings/d/{did}/w/{wid}/e/{eid}/modify) and JSON-request where logicalId is “h:100000D4” and message changed to "OnshapeEditAnnotations":
{
"description": "API test",
"jsonRequests": [
{
"formatVersion": "2021-01-01",
"messageName": "OnshapeEditAnnotations",
"annotations": [
{
"type": "Onshape::Note",
"note": {
"contents": "MESSAGE",
"logicalId": "h:100000D4"
}
}
]
}
]
}
Response of operation:
{
"parentDocumentMicroversionId": "704a8b4498b26e91c8e3366c",
"parentElementMicroversionId": "c19d1a0d8d19e9f46e89cb4b",
"requestState": "ACTIVE",
"documentId": "4e6f45e3a20648addfcaf8d7",
"elementId": "992b1314bd4e7784df36dba1",
"workspaceId": "aec51be633d7bfca83eecb5d",
"id": "6673c3d323221a0bf1c686a9",
"name": null,
"href": null
}
Status on operation GET ( /drawings/modify/status/{mrid} where mrid = 6673c3d323221a0bf1c686a9) gives response:
{
"parentDocumentMicroversionId": "704a8b4498b26e91c8e3366c",
"parentElementMicroversionId": "c19d1a0d8d19e9f46e89cb4b",
"requestState": "DONE",
"output": "{\"status\":\"OK\",\"Annotations\":{}}{ changeId : c19d1a0d8d19e9f46e89cb4b }",
"documentId": "4e6f45e3a20648addfcaf8d7",
"workspaceId": "aec51be633d7bfca83eecb5d",
"elementId": "992b1314bd4e7784df36dba1",
"name": null,
"id": "6673c3d323221a0bf1c686a9",
"href": null
}
and nothing changes in drawing´s note.
Where did I make the mistake?