Endpoint | Toiminto |
---|---|
GET api/v1/products | List products |
POST api/v1/products | Add product |
GET api/v1/products/{productId} | Get product |
PUT api/v1/products/{productId} | Edit product |
DELETE api/v1/products/{productId} | Delete product |
List products
List all products in alphabetical order.
Parameters
page
Optional
Page from which orders will be fetched. API will return 50 entries in a single page.
GET api/v1/products
cURL
curl -i -X GET -H "Authorization:Token API-KEY" 'https://test.app.paylink.fi/api/v1/products?page=1'
Response
{
"has_more": false,
"data": [
{
"id": 1,
"title": "Test product",
"tax_rate_id": "fi_standard",
"price_cents": 10000,
"created_at": "2020-08-10T18:04:37.000+03:00",
"updated_at": "2020-08-10T18:04:37.000+03:00"
},
...
]
}
Add product
Add new product.
Parameters
title
Required
Product name
tax_rate_id
Required
Tax rate ID,
fi_standard
(24 %), fi_intermediate
(14 %), fi_reduced
(10 %) or fi_zero
(0 %)
price_cents
Required
Product price in cents, either with tax or without tax depending on settings (Settings > Orders > Prices include VAT).
POST api/v1/products
cURL
curl -i -X POST \
-H "Authorization:Token API-KEY" \
-H "Content-Type:application/json" \
-d \
'{
"title": "Test product",
"tax_rate_id": "fi_standard",
"price_cents": 12400
}' \
'https://test.app.paylink.fi/api/v1/products.json'
Response
{
"id": 1,
"title": "Test product",
"tax_rate_id": "fi_standard",
"price_cents": 12400,
"created_at": "2020-08-18T12:13:40.000+03:00",
"updated_at": "2020-08-18T12:13:40.000+03:00"
}
Get product
Get product details.
Parameters
productId
Required
Product ID
GET api/v1/products/{productId}
cURL
curl -i -X GET \
-H "Authorization:Token API-KEY" \
'https://test.app.paylink.fi/api/v1/products/1'
Response
{
"id": 1,
"title": "Test product",
"tax_rate_id": "fi_standard",
"price_cents": 12400,
"created_at": "2020-08-18T12:13:40.000+03:00",
"updated_at": "2020-08-18T12:13:40.000+03:00"
}
Edit product
Edit product details.
Parameters
productId
Required
Product ID
See other parameters at Add product »
PUT api/v1/products/{productId}
cURL
curl -i -X PUT \
-H "Authorization:Token API-KEY" \
-H "Content-Type:application/json" \
-d \
'{
"title": "New product name"
}' \
'https://test.app.paylink.fi/api/v1/products/1'
Response
{
"id": 1,
"title": "New product name",
"tax_rate_id": "fi_standard",
"price_cents": 12400,
"created_at": "2020-08-18T12:13:40.000+03:00",
"updated_at": "2020-08-18T12:13:40.000+03:00"
}
Delete product
Delete product.
Parameters
productId
Required
Product ID
DELETE api/v1/products/{productId}
cURL
curl -i -X DELETE \
-H "Authorization:Token API-KEY" \
'https://test.app.paylink.fi/api/v1/products/1'