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.
REST API - Exporting a part to STEP works, but exporting to DXF does not
guillauem_d
Member Posts: 20 ✭✭
Hello there ! 
I'm trying to export my sheet metal part using the REST API, exporting it to a STEP file works fine using the following method :
Where should i plug the face ID ? Here is my working code for STEP files :
I'm trying to export my sheet metal part using the REST API, exporting it to a STEP file works fine using the following method :
- Initiate the exporting procedure using /api/v6/assemblies/d/{}/w/{}/e/{}/translations and inputing STEP as formatName
- Wait for the /api/v8/translations/{requestId} requestState to be DONE
- Download the STEP using /api/v8/translations/{requestId}
Where should i plug the face ID ? Here is my working code for STEP files :
payload = {
"allowFaultyParts": True,
"angularTolerance": 0.001,
"formatName": "STEP",
"storeInDocument": True,
}
response = requests.post(
DID, WID, EID
),
auth=(API_ACCESS, API_SECRET),
headers={
"Accept": "application/json;charset=UTF-8; qs=0.09",
"Content-Type": "application/json",
},
json=payload
)
What changes should I make to make it work with DXF ?
Thank you in advance ! 
0
Answers
I managed to get it to work, directly message me if help is required.
You cannot just list all parts and try to export them, non-sheet-metal parts will return 4xx. You need to identify flat patterns specifically using the insertables endpoint with includeFlattenedBodies=true:
Use deterministicId (from insertables), not partId (from the parts list). Export endpoints are keyed on deterministicId.
For the actual export step, use the official translations API (POST /api/v6/partstudios/d/{did}/w/{wid}/e/{eid}/translations with formatName: "DXF"). It's async — fire the job, poll /api/v6/translations/{jobId} until requestState === "DONE", then fetch the blob from resultExternalDataIds[0].