Import a dataset
POST/subscriptions/imports
Import a dataset
Request
Query Parameters
- multipart/form-data
Body
Possible values: <= 2048 characters
A unique attribute that you could use to contain information from another company system, for example. The maximum length is 2048 characters.
The JSONL file you want to upload.
Responses
- 201
- 400
- 409
- 500
Success. The import was started.
- application/json
- Schema
- Example (from schema)
Schema
- pending - Commerce has received the request but is currently busy processing other requests.
- started - Commerce has started processing the job.
- success - The job has successfully completed.
- failed - The job has failed.
data Import
The unique identifier.
Possible values: [subscription_import
]
attributes ImportAttributesrequired
Possible values: <= 2048 characters
A unique attribute that you could use to contain information from another company system, for example. The maximum length is 2048 characters.
Possible values: [pending
, started
, success
, failed
]
The status of job.
meta ImportMetarequired
The owner of a resource, either store
or organization
.
timestamps Timestampsrequired
The date and time a resource was updated.
The date and time a resource was created.
The date and time a job is started.
The date and time a job finished.
records objectrequired
You can track the number of records imported to ensure the completeness, accuracy and integrity of the import. Uploaded shows the number of records ready to be imported into Subscriptions. However, this does not mean they are valid subscription objects, only that they have the correct type and their JSON format is properly formatted. Imported shows the number of records that have been both validated and successfully added to Subscriptions.
uploaded objectrequired
The total number of products uploaded.
The total number of plans uploaded.
The total number of subscribers uploaded.
The total number of offerings uploaded.
The total number of subscriptions uploaded.
imported required
The total number of products imported.
The total number of plans imported.
The total number of subscribers imported.
The total number of offerings imported.
The total number of subscriptions imported.
{
"data": {
"id": "00000000-0000-0000-0000-000000000000",
"type": "subscription_import",
"attributes": {
"external_ref": "abc123",
"status": "pending"
},
"meta": {
"owner": "store",
"timestamps": {
"updated_at": "2017-01-10T11:41:19.244842Z",
"created_at": "2017-01-10T11:41:19.244842Z",
"started_at": "2017-01-10T11:41:19.244842Z",
"finished_at": "2017-01-10T11:41:19.244842Z"
},
"records": {
"uploaded": {
"subscription_product": 50000,
"subscription_plan": 50000,
"subscription_subscriber": 50000,
"subscription_offering": 50000,
"subscription": 50000
},
"imported": {
"subscription_product": 45090,
"subscription_plan": 45090,
"subscription_subscriber": 45090,
"subscription_offering": 45090,
"subscription": 45090
}
}
}
}
}
Bad request. The request failed validation.
- application/json
- Schema
- Example (from schema)
- missing-name
Schema
- Array [
- ]
errors Error[]required
The HTTP response code of the error.
A brief summary of the error.
Optional additional detail about the error.
Additional supporting meta data for the error.
{
"errors": [
{
"status": 500,
"title": "Internal server error",
"detail": "An internal error has occurred.",
"meta": {
"missing_ids": [
"e7d50bd5-1833-43c0-9848-f9d325b08be8"
]
}
}
]
}
{
"errors": [
{
"title": "Validation Error",
"status": "400",
"detail": "data.attributes.name: \"name\" is required"
}
]
}
Write conflict. Unable to perform the operation at this time.
- application/json
- Schema
- Example (from schema)
- Example
Schema
- Array [
- ]
errors Error[]required
The HTTP response code of the error.
A brief summary of the error.
Optional additional detail about the error.
Additional supporting meta data for the error.
{
"errors": [
{
"status": 500,
"title": "Internal server error",
"detail": "An internal error has occurred.",
"meta": {
"missing_ids": [
"e7d50bd5-1833-43c0-9848-f9d325b08be8"
]
}
}
]
}
{
"errors": [
{
"title": "Write Conflict",
"status": "409"
}
]
}
Internal server error. There was a system failure in the platform.
- application/json
- Schema
- Example (from schema)
- internal-server-error
Schema
- Array [
- ]
errors Error[]required
The HTTP response code of the error.
A brief summary of the error.
Optional additional detail about the error.
Additional supporting meta data for the error.
{
"errors": [
{
"status": 500,
"title": "Internal server error",
"detail": "An internal error has occurred.",
"meta": {
"missing_ids": [
"e7d50bd5-1833-43c0-9848-f9d325b08be8"
]
}
}
]
}
{
"errors": [
{
"title": "Internal Server Error",
"status": "500"
}
]
}