Request

Response

    POST

    modeldata/{modelID}/create

    Creates elements based on the input payload. The scope of creation is one model.

    Resource Information

    Method and URI
    POST
    https://developer.api.autodesk.com/tandem/v1/modeldata/{modelID}/create
    Authentication Context
    user context optional
    Required OAuth Scopes
    data:write
    Data Format
    JSON

    Request

    Headers

    Authorization*
    string
    Must be Bearer <token>, where <token> is a two-legged access token obtained via a Client Credentials Grant flow, or a three-legged access token obtained via Authorization Code flow, Authorization Code flow with PKCE, or Secure Service Account flow (for headless scenarios).
    Region
    string
    Specifies the region where your request should be routed. Possible values: US, EMEA. For more details, see Regions.
    Content-Type*
    string
    Must be application/json
    * Required

    Request

    URI Parameters

    modelID
    string
    Model URN

    Request

    Body Structure

    Create parameters

    Expand all
    desc
    string
    Description, provides more details about the context.
    keys
    array: string
    Optional keys to be used by server for new elements.
    muts
    array: object
    Changes to be applied ([“operation type”, “family”, “attribute id”, “new value”]).
    column
    string
    family
    string
    op
    string
    value
    object

    Response

    HTTP Status Code Summary

    200
    OK
    OK
    400
    Bad Request
    The service was unable to process the request. The syntax of the request may be malformed or the request may be missing a required header. Do not resend the request without fixing the issue. The response body may indicate what is wrong with the request.
    403
    Forbidden
    The request was successfully validated but it did not have the required permissions.

    Response

    Body Structure (200)

    key
    string
    key if newly created element
    timestamp
    int
    timestamp of when exactly change was applied

    Example

    /create is used to create a new Stream element. However, this is only one of several endpoints that must be called to successfully create a Stream, so see Streams and code examples for the full workflow necessary to create a stream. /create works very similar to /mutate but does not require an elementKey to be passed in. Instead, it will return the key of the newly created element.

    • The value for Qualified Property “n:a” is a built in enum that identifies this object as a Stream. Always use this value.
    • The value for Qualified Property “n:!u” is a built in enum that sets its internal class. Always use this value.
    curl -v 'https://developer.api.autodesk.com/api/v1/modeldata/urn:adsk.dtm:d5eZt_XtRzqUHT93-vNZxw/create' \
      -X 'POST' \
      -H 'Authorization: Bearer eyJhbGciOiJSUzI1NiIsIm....' \
      -H 'Content-Type: application/json' \
      -d '{
            "muts": [
                [
                    "i",
                    "n",
                    "n",
                    "Test Stream"
                ],
                [
                    "i",
                    "n",
                    "!n",
                    "Test Stream (with overriddenName)"
                ],
                [
                    "i",
                    "n",
                    "a",
                    16777219
                ],
                [
                    "i",
                    "n",
                    "!u",
                    "D7070"
                ]
            ],
            "desc": "Stream created via REST API"
        }'
    
    Show More

    Response

    {
      "key": "AQAAAC37Lzxn_0tel2x-tD2JGD4AAAAA",
      "timestamp": 1697742810797000
    }
    

    Streams are always created in the ‘default’ model of the given facility. You can either look that up programmatically by iterating over all the models and checking their flags, or there is a short-cut by just substituting “dtm” for “dtt” in the URN of the Facility. The following utility function does this:

    export function getDefaultModel(facilityURN) {
      const defaultModelURN = facilityURN.replace("urn:adsk.dtt:", "urn:adsk.dtm:");
      return defaultModelURN;
    }