Creates new enumerations.
POST
v1/enumerations:batch-create
Creates new enumeration definitions.
The maximum number per request is 50. For changing enumeration definitions, use the update enumerations 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/enumerations: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. |
* Required
Request
Body Structure
Object
Expand all
| enumerations* array: object | The list of enumerations to update. |
| id string | The enumeration ID. Must be full type id. |
| name* string | The enumeration name.
The length of the enumeration name is limited to 255 characters.
An enumeration name can’t be a restricted word: mm cm m km log sqrt sin cos tan asin acos atan exp abs pi round roundup rounddn
An enumeration’s name can’t contain any of these prohibited symbol(s): \ : { } [ ]` |
| content* object | The enumeration content. Must be a non-empty map with keys of type string and values of type number. For more information about specs and enumerations, please refer to the Field Guide. |
* Required
Response
HTTP Status Code Summary
| 201 Created | Successfully created the enumerations. |
| 207 Partial Success | Successfully created some of the enumerations, with errors for some enumerations in the batch. |
| 400 Bad Request | The request could not be understood by the server due to malformed syntax. This may occur when enumeration validation fails, such as when the enumeration 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 enumeration creation results. |
| id string | The enumeration ID. |
| name string | The enumeration name. |
| content object | The enumeration content. 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 enumeration. |
| createdAt string | A Time ISO 8601 Timestamp in UTC Timezone indicating when the enumeration was created. |
Body Structure (207)
Expand all
| results array: object | The enumeration creation results. |
| id string | The enumeration ID. |
| name string | The enumeration name. |
| content object | The enumeration content. Must be non empty 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 enumeration. |
| createdAt string | A Time ISO 8601 Timestamp in UTC Timezone indicating when the enumeration 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 Enumeration(s) (201)
Request
curl -v 'https://developer.api.autodesk.com/parameters/v1/enumerations:batch-create?accountId=b3aef626-f535-4c7a-a032-c1048416f5ea' \
-X 'POST' \
-H 'Authorization: Bearer AuIPTf4KYLTYGVnOHQ0cuolwCW2F' \
-H 'Content-Type: application/json' \
-d '{
"enumerations": [
{
"name": "Stoplight Color",
"content": [
{
"id": "Red",
"value": 0
},
{
"id": "Yellow",
"value": 1
},
{
"id": "Green",
"value": 2
}
]
}
]
}'
Show More
Response
{
"results": [
{
"id": "parameters.b3aef626f5354c7aa032c1048416f5ea:61712b031b1e49e897e3cf1643dea73e-1.0.0",
"name": "Stoplight Color",
"content": [
{
"id": "Red",
"value": 0
},
{
"id": "Yellow",
"value": 1
},
{
"id": "Green",
"value": 2
}
],
"createdBy": "FXA2K4JGR5BECGSF",
"createdAt": "2024-11-11T16:18:53+0000"
}
]
}
Show More
Partial Success Creating Enumerations (207)
Request
curl -v 'https://developer.api.autodesk.com/parameters/v1/enumerations:batch-create?accountId=b3aef626-f535-4c7a-a032-c1048416f5ea' \
-X 'POST' \
-H 'Authorization: Bearer AuIPTf4KYLTYGVnOHQ0cuolwCW2a' \
-H 'Content-Type: application/json' \
-d '{
"enumerations": [
{
"name": "Stoplight Color",
"content": [
{
"id": "Red",
"value": 0
},
{
"id": "Yellow",
"value": 1
},
{
"id": "Green",
"value": 2
}
]
},
{
"name": "Door Swing Direction",
"content": [
{
"id": "Into Room",
"value": -1
},
{
"id": "Out of Room",
"value": 1
}
]
}
]
}'
Show More
Response
{
"results": [
{
"id": "parameters.b3aef626f5354c7aa032c1048416f5ea:61712b031b1e49e897e3cf1643dea73e-1.0.0",
"name": "Stoplight Color",
"content": [
{
"id": "Red",
"value": 0
},
{
"id": "Yellow",
"value": 1
},
{
"id": "Green",
"value": 2
}
],
"createdBy": "FXA2K4JGR5BECGSR",
"createdAt": "2024-11-19T19:17:05+0000"
}
],
"errors": [
{
"id": "dec8e229344745538a055f24d865c27e",
"title": "Bad request",
"detail": "The enumeration content value is invalid, it must be a positive integer number"
}
]
}
Show More