Important!
The 3D print API is shutting down on January 15, 2017. See our end of life notice for more information.
POST meshes/import¶a>
Creates a mesh from a 3D geometry file. Currently supported file types are 3MF, binary STL, ASCII STL, OBJ, or a ZIP file containing an OBJ file (and optionally, associated MTL file and texture images in PNG or JPG format).
Note that this endpoint is asynchronous and initiates a task that runs in the background, rather than halting execution of your program. The response returns a task id
that you need to use to call the GET tasks/:id endpoint, which retreives the new mesh object. For further details, see the GET tasks/:id endpoint.
Resource Information¶
Method and URI | POST https:/ |
Authentication Context | user context required |
Required OAuth Scopes | data:read data:write |
Data Format | JSON |
Request¶
Headers¶
Name |
Required |
Value Type |
Description |
---|---|---|---|
Authorization | yes | string | Must be Bearer <token> , where <token> is obtained via a three- |
Content-Type | yes | string | Must be application/json |
Body Structure¶
The POST body is a single, flat JSON object with the following attributes:
Name |
Required |
Value Type |
Description |
---|---|---|---|
file_id | yes | string: UUID | The URN of the file you uploaded to OSS. See See the Upload File tutorial for more details. |
file_type | no | enum: string | File type of the file that was uploaded to OSS. Only necessary if unspecified in the name of the uploaded file. To verify, check at the end of the URN. E.g., urn :adsk.objects:os.object:mybucket/robot.stl. |
name | no | string | Name of the new mesh. |
transform | no | array: array: int | An array of 12 numbers representing a 3D affine transformation matrix.
An affine transformation matrix positions and scales the mesh in the
printer’s three dimensional build space. It is specified as the first
three columns of a 4x4 matrix in which the last column is implicit and
set to [ 0, 0, 0, 1 ] . |
Response¶
HTTP Status Code Summary¶
Code |
Message |
Meaning |
---|---|---|
202 | OK | Successful created a mesh import task |
400 | Bad Request | Invalid request. E.g., the request could not be parsed. |
401 | Unauthorized | Invalid authorization header. E.g., user is not logged in, or cannot access resource. |
404 | Not Found | Endpoint does not exist. |
422 | Unprocessable Entity | Semantic errors |
429 | Precondition Required | Request rate limit exceeded |
500 | Internal Server Error | An unknown error occurred on the server. |
Body Structure (202)¶
The response body is a single, flat JSON object with the following attributes:
Field |
Type |
Description |
---|---|---|
id | string: UUID | Task ID |
status | enum: string | Possible values: running , done , and error |
progress | float | A value between 0 (not started) and 1 (complete) indicating percentage complete |
result | object | The response if status is done |
error | object | The error message if status is error |
Examples¶
Task for Importing a Mesh Successfully Created (202)¶
curl -X 'POST' -H 'Authorization: Bearer WmzXZq9MATYyfrnOFpYOE75sL5dh' -H 'Content-Type: application/json' -v 'https://developer.api.autodesk.com/ps/v1/geom/meshes/import/' -d '
{
"file_id" : "urn:adsk.objects:os.object:testprintbucket/mystlfile.stl",
"file_type" : "stl",
"name" : "frog",
"transform" : [[1,0,0,0],[0,1,0,0],[0,0,1,0]]
}'
{
"id": "17c8dc1e-2c1c-46cd-ad60-c8d5cad07aec",
"progress": 0,
"status": "running",
"task_update_time": "2016-06-05T15:30:30.569Z"
}
For an example of a completed task result, see the Examples section in the GET tasks/:id endpoint documentation.