Creates new specs.
POST
v1/specs:batch-create
Creates new specs.
The maximum number per request is 50. For changing spec definitions, use the update specs API to set them. Use List Collections API to get the collection ID.
Resource Information
| Method and URI | POST https://developer.api.autodesk.com/parameters/v1/specs:batch-create |
| Authentication Context | user context required |
| Required OAuth Scopes | data:create or data:write |
| Data Format | JSON |
Request
Headers
| Authorization* string | Must be Bearer <token>, where <token> is obtained via a three-legged OAuth flow. |
| Content-Type* string | Must be application/json |
| Region string | The region the hub’s data is provisioned in.
Currently supports US, EMEA, AUS, IND, DEU, JPN, CAN, and GBR. Default is US. |
* Required
Request
Query Parameters
| accountId string: UUID or string: b.UUID | The Autodesk Forma hub ID. Required. |
Request
Body Structure
Object
Expand all
| specs* array: object | The list of specs to create. |
| id string | The spec ID. Must be full type id. |
| valueTypeId* string | The identifier of the storage value type, which could be a primitive type ID, such as Bool, Int64, Float64, String, DateTime, URI, Date, or a complex type ID. Value Type IDs support version ranges. For more information about version ranges in specs, please refer to the Field Guide. |
| context* object | The spec context - “single” or “array”. For more information about specs and enumerations, please refer to the Field Guide. |
* Required
Response
HTTP Status Code Summary
| 201 Created | Successfully created the spec. |
| 207 Partial Success | Successfully created some of the spec, with errors for some spec in the batch. |
| 400 Bad Request | The request could not be understood by the server due to malformed syntax. This may occur when spec validation fails, such as when the spec name is too long or contains prohibited symbols. The response should include what validation rule was violated. |
| 401 Unauthorized | Request has not been applied because it lacks valid authentication credentials for the target resource. |
| 403 Forbidden | The server understood the request but refuses to authorize it. |
| 404 Not Found | The resource cannot be found. |
| 406 Not Acceptable | The server cannot produce a response matching the list of acceptable values defined in the request. |
| 410 Gone | Access to the target resource is no longer available. |
| 429 Too Many Requests | User has sent too many requests in a given amount of time. |
| 500 Internal Server Error | An unexpected error occurred on the server. |
| 503 Service Unavailable | Server is not ready to handle the request. |
Response
Body Structure (201)
Expand all
| results array: object | The spec creation results. |
| id string | The spec ID. |
| name string | The user-facing name of the spec. |
| disciplineId string | The discipline ID. Look up detailed information in the response of the GET /disciplines API. |
| applicableUnitIds array: string | The identifiers of the units applicable to this spec. This field exists only for measurable specs that are associated with units of measurement, such as “Length” or “Acceleration”. It is null for non-measurable specs such as “Text” or “Yes/No”. |
| storageUnitId string | The identifier of the storage unit of this spec. This field exists only for measurable specs that are associated with units of measurement, such as “Length” or “Acceleration”. It is null for non-measurable specs such as “Text” or “Yes/No”. The storage unit is the unit of measurement that quantifies values of this parameter in persistent storage. When writing parameter values, client applications must ensure that the values written are quantified according to each parameter’s storage unit. A unit conversion might be necessary if input values are quantified differently. |
| valueTypeId string | The identifier of the storage value type, which could be Bool, Int64, Float64, Reference, String or a type ID. Value Type IDs support version ranges. For more information about version ranges in specs, please refer to the Field Guide. Results are returned for the highest applicable Value Type Id version available. |
| context string | The value “single” indicates that the spec stores a single value. The value “array” indicates that the spec stores an array of values. |
| content array: object | The spec content. Provided only for specs with enumeration value types, this field contains the body of the enumeration as a map with keys of type string and values of type number. |
| id string | The enumeration ID for a single item in the list. |
| value number | The enumeration value for a single item in the list. |
| createdBy string | User that created the spec. |
| createdAt string | A Time ISO 8601 Timestamp in UTC Timezone indicating when the spec was created. |
Body Structure (207)
Expand all
| results array: object | The spec creation results. |
| id string | The spec ID. |
| name string | The user-facing name of the spec. |
| disciplineId string | The discipline ID. Look up detailed information in the response of the GET /disciplines API. |
| applicableUnitIds array: string | The identifiers of the units applicable to this spec. This field exists only for measurable specs that are associated with units of measurement, such as “Length” or “Acceleration”. It is null for non-measurable specs such as “Text” or “Yes/No”. |
| storageUnitId string | The identifier of the storage unit of this spec. This field exists only for measurable specs that are associated with units of measurement, such as “Length” or “Acceleration”. It is null for non-measurable specs such as “Text” or “Yes/No”. The storage unit is the unit of measurement that quantifies values of this parameter in persistent storage. When writing parameter values, client applications must ensure that the values written are quantified according to each parameter’s storage unit. A unit conversion might be necessary if input values are quantified differently. |
| valueTypeId string | The identifier of the storage value type, which could be Bool, Int64, Float64, Reference, String or a type ID. Value Type IDs support version ranges. For more information about version ranges in specs, please refer to the Field Guide. Results are returned for the highest applicable Value Type Id version available. |
| context string | The value “single” indicates that the spec stores a single value. The value “array” indicates that the spec stores an array of values. |
| content array: object | The spec content. Provided only for specs with enumeration value types, this field contains the body of the enumeration as a map with keys of type string and values of type number. |
| id string | The enumeration ID for a single item in the list. |
| value number | The enumeration value for a single item in the list. |
| createdBy string | User that created the spec. |
| createdAt string | A Time ISO 8601 Timestamp in UTC Timezone indicating when the spec was created. |
| errors array: object | The errors. |
| id string | The resource ID. |
| title string | The error title. |
| detail string | The error detail. |
| code string | The error code. |
Example
Successfully Created Spec(s) (201)
Request
curl -v 'https://developer.api.autodesk.com/parameters/v1/specs:batch-create?accountId=b3aef626-f535-4c7a-a032-c1048416f5ea' \
-X 'POST' \
-H 'Authorization: Bearer AuIPTf4KYLTYGVnOHQ0cuolwCW2a' \
-H 'Content-Type: application/json' \
-d '{
"specs": [
{
"valueTypeId": "parameters.b3aef626f5354c7aa032c1048416f5ea:61712b031b1e49e897e3cf1643dea73e-1.0.0",
"context": "single"
},
{
"valueTypeId": "parameters.b3aef626f5354c7aa032c1048416f5ea:61712b031b1e49e897e3cf1643dea73e-1.0.0",
"context": "array"
}
]
}'
Show More
Response
{
"results": [
{
"id": "parameters.b3aef626f5354c7aa032c1048416f5ea:8bb37d61b3dc489aa94d6bac3d88038c-1.0.0",
"name": "Multiple Select: some spec",
"valueTypeId": "b3aef626-f535-4c7a-a032-c1048416f5ea:61712b031b1e49e897e3cf1643dea73e-1.0.0",
"context": "array",
"createdBy": "FXA2K4JGR5BECGSR",
"createdAt": "2024-11-11T16:18:56+0000",
"disciplineId": "autodesk.spec:discipline-2.0.0",
"applicableUnitIds": null,
"storageUnitId": null,
"content": [
{
"id": "item1",
"value": 0
},
{
"id": "item2",
"value": 1
}
]
},
{
"id": "b3aef626-f535-4c7a-a032-c1048416f5ea:d8cf6d9ae20d4775b1a246399d4ff48a-1.0.0",
"name": "Single Select: some spec",
"valueTypeId": "b3aef626-f535-4c7a-a032-c1048416f5ea:61712b031b1e49e897e3cf1643dea73e-1.0.0",
"context": "single",
"createdBy": "FXA2K4JGR5BECGSR",
"createdAt": "2024-11-11T16:18:56+0000",
"disciplineId": "autodesk.spec:discipline-2.0.0",
"applicableUnitIds": null,
"storageUnitId": null,
"content": [
{
"id": "item1",
"value": 0
},
{
"id": "item2",
"value": 1
}
]
}
]
}
Show More
Partial Success Creating Specs (207)
Request
curl -v 'https://developer.api.autodesk.com/parameters/v1/specs:batch-create?accountId=b3aef626-f535-4c7a-a032-c1048416f5ea' \
-X 'POST' \
-H 'Authorization: Bearer AuIPTf4KYLTYGVnOHQ0cuolwCW2a' \
-H 'Content-Type: application/json' \
-d '{
"specs": [
{
"valueTypeId": "parameters.b3aef626f5354c7aa032c1048416f5ea:95d502d557524f45a1bdad92f8b73fcf-2.0.0",
"context": "array"
},
{
"valueTypeId": "parameters.b3aef626f5354c7aa032c1048416f5ea:95d502d557524f45a1bdad92f8b73fcf-2.0.0",
"context": "single"
},
{
"valueTypeId": "parameters.b3aef626f5354c7aa032c1048416f5ea:a644eb8695914628a259fd5a3b37f622-2.0.1",
"context": "array1"
},
{
"valueTypeId": "parameters.b3aef626f5354c7aa032c1048416f5ea:a644eb8695914628a259fd5a3b37f622-2.0.1",
"context": "single1"
}
]
}'
Show More
Response
{
"results": [
{
"id": "parameters.b3aef626f5354c7aa032c1048416f5ea:233873a17cd044a7a25a32549d95f53e-1.0.0",
"name": "Single Select: some spec2",
"valueTypeId": "parameters.d05ec054ef8046ad9c80fc742f29027c:95d502d557524f45a1bdad92f8b73fcf-2.0.0",
"context": "single",
"createdBy": "FXA2K4JGR5BECGSR",
"createdAt": "2024-11-19T19:38:43+0000",
"disciplineId": "autodesk.spec:discipline-2.0.0",
"applicableUnitIds": null,
"storageUnitId": null,
"content": [
{
"id": "item2000",
"value": 2
}
]
},
{
"id": "parameters.b3aef626f5354c7aa032c1048416f5ea:fb6bbd78f30e438cb1b22ed9d50e9c91-1.0.0",
"name": "Multiple Select: some spec2",
"valueTypeId": "parameters.d05ec054ef8046ad9c80fc742f29027c:95d502d557524f45a1bdad92f8b73fcf-2.0.0",
"context": "array",
"createdBy": "FXA2K4JGR5BECGSR",
"createdAt": "2024-11-19T19:38:43+0000",
"disciplineId": "autodesk.spec:discipline-2.0.0",
"applicableUnitIds": null,
"storageUnitId": null,
"content": [
{
"id": "item2000",
"value": 2
}
]
}
],
"errors": [
{
"code": "SPEC-INVALID-SPEC",
"title": "Bad request",
"detail": "Cannot read properties of undefined (reading 'value')",
"id": "eb848cecdd804386838dcb615f5a75cb"
},
{
"code": "SPEC-INVALID-SPEC",
"title": "Bad request",
"detail": "Cannot read properties of undefined (reading 'value')",
"id": "f9bfa9a8c0bc42bf9fbf1c5064478b92"
}
]
}
Show More