/variant_collections endpoint¶
The /variant_collections endpoint provides methods for listing, creating, and updating variant collections in DropStream.
List¶
To get a list of variant collections and their properties, make a GET request to /variant_collections.
| Endpoint | /variant_collections |
|---|---|
| Method | GET |
| Auth | JWT |
| Success status | HTTP 200 |
| Response (JSON) | Array of all variant_collection objects |
Example
curl -H "Authorization: Bearer $JWT_TOKEN" \
https://api.getdropstream.com/variant_collections
Response:
[
{
"name": "Shoes",
"product_ids": [
12345,
23456,
34567
]
}
]
HTTP/1.1 200 OK
Create¶
To create a new variant collection, make a POST request to /variant_collections with the properties of the new variant_collection.
| Endpoint | /variant_collection |
|---|---|
| Method | POST |
| Auth | JWT |
| Payload | Properties of the new variant_collection object |
| Required properties |
|
| Success status | HTTP 201 |
| Response (JSON) | id of the new variant_collection object |
Example
curl -X POST \
-H "Authorization: Bearer $JWT_TOKEN" \
-H "Content-Type: application/json" \
https://api.getdropstream.com/variant_collections \
-d @- <<EOF
{
"name": "Shoes",
"product_ids": [
12345,
23456,
34567
]
}
EOF
curl -X POST \
-H "Authorization: Bearer $JWT_TOKEN" \
https://api.getdropstream.com/variant_collections \
-d @- <<EOF
name=Shoes&
product_ids=[12345,23456,34567]
EOF
Response:
{"id":45678}
HTTP/1.1 201 Created
Update¶
To update an existing variant collection, make a PATCH request to /variant_collections/{id} with the updated properties.
| Endpoint | /variant_collections/{variant_collection_id} |
|---|---|
| Method | PATCH |
| Auth | JWT |
| Payload | the updated variant_collection properties |
| Success status | HTTP 204 |
Example
curl -X PATCH \
-H "Authorization: Bearer $JWT_TOKEN" \
-H "Content-Type: application/json" \
https://api.getdropstream.com/variant_collections/1234 \
-d @- <<EOF
{
"name": "Sandals",
"product_ids": [
56789,
67890
]
}
EOF
curl -X PATCH \
-H "Authorization: Bearer $JWT_TOKEN" \
https://api.getdropstream.com/variant_collections/1234 \
-d @- <<EOF
name=Sandals&
product_ids=[56789,67890]
EOF
Response:
HTTP/1.1 204 No Content