/products endpoint¶
The /products endpoint provides methods for listing, creating, and updating the properties of products in DropStream.
List¶
To get a list of products and their properties, make a GET request to /products.
| Endpoint | /products |
|---|---|
| Method | GET |
| Auth | JWT |
| Success status | HTTP 200 |
| Response (JSON) |
|
Example
curl -H "Authorization: Bearer $JWT_TOKEN" \
https://api.getdropstream.com/products \
-d @- <<EOF
{"customer_id":"3775"}
EOF
Response:
{
"products": [
{
"id": 12345,
"customer_id": 3775,
"sku": "abc",
"created_at": "2021-08-02T21:07:39.000Z",
"variant_of": "Shoes",
"bundle": [
{
"product_id": 2,
"qty": 2
}
]
},
{
"id": 23456,
"customer_id": 3775,
"sku": "abc-123",
"created_at": "2021-08-03T19:20:12.000Z"
},
{
"id": 34567,
"customer_id": 3775,
"sku": "abc-234",
"created_at": "2021-08-03T19:21:19.000Z"
},
{
"id": 45678,
"customer_id": 3775,
"sku": "bcd-123",
"variant_of": "Tennis Racquets",
"created_at": "2021-08-03T19:21:33.000Z"
},
{
"id": 56789,
"customer_id": 3775,
"master_id": 45678,
"sku": "bcd-234",
"created_at": "2021-08-03T19:52:06.000Z",
}
],
"page": 1,
"limit": 1000,
"total_count": 5,
"total_pages": 1
}
HTTP/1.1 200 OK
Create¶
To create a new product, make a POST request to /products with the product properties.
| Endpoint | /products |
|---|---|
| Method | POST |
| Auth | JWT |
| Payload | Properties of the new product object |
| Required properties |
|
| Success status | HTTP 201 |
| Response (JSON) | id of the new product |
Example
curl -X POST \
-H "Authorization: Bearer $JWT_TOKEN" \
-H "Content-Type: application/json" \
https://api.getdropstream.com/products \
-d @- <<EOF
{
"customer_id": "3775",
"sku": "abc-123",
"variant_of": "Bath Towels",
"bundle": [
{
"product_id": 12345,
"qty": 2
}
],
"master_id": 34567
}
EOF
curl -X POST \
-H "Authorization: Bearer $JWT_TOKEN" \
https://api.getdropstream.com/products \
-d @- <<EOF
customer_id=3775&
sku=abc-123&
variant_of=Bath Towels&
bundle[0][product_id]=12345&
bundle[0][qty]=2&
master_id=23456
EOF
Response:
{"id":34567}
HTTP/1.1 201 Created
Update¶
To update an existing product, make a PATCH request to /products/{id} with the updated properties.
| Endpoint | /products/{product_id} |
|---|---|
| Method | PATCH |
| Auth | JWT |
| Payload | the updated product properties |
| Success status | HTTP 204 |
Example
curl -X PATCH \
-H "Authorization: Bearer $JWT_TOKEN" \
-H "Content-Type: application/json"
https://api.getdropstream.com/products/12345 \
-d @- <<EOF
{
"sku": "abc-123",
"variant_of": "Sandals"
}
EOF
curl -X PATCH \
-H "Authorization: Bearer $JWT_TOKEN" \
https://api.getdropstream.com/products/12345 \
-d @- <<EOF
sku=abc-123&
variant_of=Sandals
EOF
Response:
HTTP/1.1 204 No Content