Table of Contents
Creating a product
Exchange #1
Request
POST https://.../url-1
Accept: application/hal+json, application/vnd.error+json
Content-Type: application/hal+json
{
"active": true,
"name": "Daddel",
"vatType": "HIGH",
"incomeAccount": "3010"
}
Response
201 Created
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Content-Length: ...
Date: ...
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Location: https://.../url-2
X-Request-ID: <random UUID>
Exchange #2
Request
GET https://.../url-2
Accept: application/hal+json, application/vnd.error+json
Response
200 OK
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Content-Length: ...
Content-Type: application/hal+json;charset=UTF-8
Date: ...
Expires: Thu, 01 Jan 1970 00:00:00 GMT
X-Request-ID: <random UUID>
{
"_links": {
"self": {
"href": "https://.../url-2"
}
},
"name": "Daddel",
"incomeAccount": "3010",
"vatType": "HIGH",
"active": true
}
We have now created a product called Daddel
Fetching all products, including the new one.
Exchange #3
Request
GET https://.../url-1
Accept: application/hal+json, application/vnd.error+json
Response
200 OK
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Content-Length: ...
Content-Type: application/hal+json;charset=UTF-8
Date: ...
Expires: Thu, 01 Jan 1970 00:00:00 GMT
X-Request-ID: <random UUID>
{
"_links": {
"self": {
"href": "https://.../url-1"
}
},
"_embedded": {
"https://fiken.no/api/v1/rel/products": [
{
"_links": {
"self": {
"href": "https://.../url-3"
}
},
"name": "Testprodukt #8",
"unitPrice": 10696,
"incomeAccount": "3000",
"vatType": "HIGH",
"active": true,
"stock": -0.6000000000,
"productNumber": "8"
},
{
"_links": {
"self": {
"href": "https://.../url-2"
}
},
"name": "Daddel",
"incomeAccount": "3010",
"vatType": "HIGH",
"active": true
},
{
"_links": {
"self": {
"href": "https://.../url-4"
}
},
"name": "Testprodukt #9",
"unitPrice": 12033,
"incomeAccount": "3030",
"vatType": "MEDIUM",
"active": true,
"stock": -8.3000000000,
"productNumber": "9"
},
{
"_links": {
"self": {
"href": "https://.../url-5"
}
},
"name": "Testprodukt #1",
"unitPrice": 1337,
"incomeAccount": "3030",
"vatType": "MEDIUM",
"active": true,
"stock": -52.7000000000,
"productNumber": "1"
},
{
"_links": {
"self": {
"href": "https://.../url-6"
}
},
"name": "Testprodukt #2",
"unitPrice": 2674,
"incomeAccount": "3000",
"vatType": "HIGH",
"active": true,
"stock": -31.4000000000,
"productNumber": "2"
},
{
"_links": {
"self": {
"href": "https://.../url-7"
}
},
"name": "Testprodukt #3",
"unitPrice": 4011,
"incomeAccount": "3030",
"vatType": "MEDIUM",
"active": true,
"stock": 1.9000000000,
"productNumber": "3"
},
{
"_links": {
"self": {
"href": "https://.../url-8"
}
},
"name": "Testprodukt #4",
"unitPrice": 5348,
"incomeAccount": "3000",
"vatType": "HIGH",
"active": true,
"stock": -79.8000000000,
"productNumber": "4"
},
{
"_links": {
"self": {
"href": "https://.../url-9"
}
},
"name": "Testprodukt #5",
"incomeAccount": "3030",
"vatType": "MEDIUM",
"active": true,
"stock": 4.5000000000,
"productNumber": "5"
},
{
"_links": {
"self": {
"href": "https://.../url-10"
}
},
"name": "Testprodukt #6",
"unitPrice": 8022,
"incomeAccount": "3000",
"vatType": "HIGH",
"active": true,
"stock": 5.8000000000,
"productNumber": "6"
},
{
"_links": {
"self": {
"href": "https://.../url-11"
}
},
"name": "Testprodukt #7",
"unitPrice": 9359,
"incomeAccount": "3030",
"vatType": "MEDIUM",
"active": true,
"stock": -75.9000000000,
"productNumber": "7"
}
]
}
}
Deleting the product we created
Exchange #4
Request
DELETE https://.../url-2
Accept: application/hal+json, application/vnd.error+json
Response
204 No Content
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Date: ...
Expires: Thu, 01 Jan 1970 00:00:00 GMT
X-Request-ID: <random UUID>