Quickbutik API

Välkommen till dokumentationen för Quickbutiks API & Webhooks.
API
Introduktion

Quickbutik API är ett så kallad REST API, uppbyggd efter REST arkitekturen. Vårt API har resursoritenterade och förutsägbara URLs och använder HTTP svarskoder för att indikera status för anropet. Alla svar returneras i JSON, även felmeddelanden.

Samtliga API anrop görs till: https://api.quickbutik.com/v1

Alla önskemål, feedback eller tekniska frågor är välkomna på support@quickbutik.com.

Autentisering

Alla anrop sker med Basic Authorization-autentiseringsmetoden som skickas med i alla anrop. Detta används för att identifiera dig som API-användare med den Quickbutik som du önskar åtkomst till.

Basic Authorization är den enklaste tekniken för att hantera åtkomst och behörighet på ett standardiserat sätt. Det består huvudsakligen av en HTTP Authorization Basic header följt av användaruppgifterna (username och password) - kodade med base64.

För anrop till Quickbutik API, använder du API key som username och password. api_key:api_key (base64-encoded).

Exempel header: authorization: Basic YXBpX2tleV9oZXJlOmFwaV9rZXlfaGVyZQ==

Din API nyckel kan skapas och hanteras i Quickbutiks kontrollpanel under Inställningar > API av butiksägaren.

Alla API anrop måste ske över HTTPS. Alla anrop med vanlig HTTP nekas och likadant för anrop utan autentisering.

Update: Arbetar du med Quickbutik API sedan tidigare? Tidigare existerande autentiseringsmetod (apiKey-query) kommer att avvecklas inom kort och vi rekommenderar därför att ni uppdaterar till ovanstående autentiseringsmetod.

Products
GET /v1/products
POST /v1/products
PUT /v1/products
Hämta produkter
GET /v1/products

Hämta butikens produktdata

Request parameters

product_id
string optional

Specifik id för produkt som önskas

Examples:
1010,12,14

Request body

Responses

200 OK

(utan product_id)

application/json
200 OK

(med product id)

application/json
404 Kunde inte hittas

Produkten kunde inte hittas

Exempel 1 (Specifik)
Exempel 2 (Ospecifik)

Specifik produkt efterfrågas, fullständig produktinformation.

GET https://api.quickbutik.com/v1/products?product_id=123 HTTP/1.1 

Content-Type: application/json

Ingen specifik produkt efterfrågas - laddar 50 senaste produkter (förenklad produktinformation).

GET https://api.quickbutik.com/v1/products HTTP/1.1 

Content-Type: application/json
Skapa produkter
POST /v1/products

Lägg till produkter i butiken

Request body

Object
sku
string

Artikelnummer

Example:
T-SHIRT123
title
string

Produkttitel

Example:
My white tee!
price
integer

Pris

Example:
299
before_price
integer

Jämförelsepris

Example:
399
purchase_price
integer

Inköpspris (exkl. moms)

Example:
69
tax_rate
integer

Momssats

weight
number

Vikt (i gram)

Example:
400
stock
integer

Lagersaldo

Example:
1
gtin
string
headcategory_name
string
Example:
T-shirts
visible
integer
Example:
1
disable_minusqty
string

Avaktivera minuslager

Examples:
10

Responses

200 OK

Produkten har skapats

Body
application/json
Object
created
Array
Object
product_id
integer
Example:
123
success
integer
Example:
1
404 FEL

Ett fel inträffades.

Skapa enskild produkt
Skapa flera produkter
[
  {
    "sku": "SHIRT-123",
    "title": "T-shirt",
    "description":"<p><strong>This is so cool!</strong> Heee</p>",
    "price": 199
  }
]
[
  {
    "sku": "SHIRT-123",
    "title": "T-shirt",
    "description":"<p><strong>This is so cool!</strong> Heee</p>",
    "price": 199
  },
  {
    "sku": "SHIRT-333",
    "title": "T-shirt Special",
    "description":"<p><strong>This is so so cool!</strong> Heee</p>",
    "price": 399
  }
]
Uppdatera produkter
PUT /v1/products

Uppdatera produkter i butiken.

Produkten som ni önskar att uppdatera kan identifieras genom Produkt ID (+Produktvariant ID om behövs) eller direkt via Artikelnummer.

Request body

Object
product_id
integer

Produkt ID - som du önskar att uppdatera

variant_id
integer

Produktvariant ID - som du önskar att uppdatera (om det är en variant)

sku
string

(ELLER) Artikelnummer - på produkt/variant som du önskar att uppdatera

title
string

Produkttitel

price
integer

Pris

Example:
299
before_price
integer

Valfritt: Jämförelsepris

Example:
399
purchase_price
integer

Valfritt: Inköpspris (exkl. moms)

Example:
69
tax_rate
integer

Momssats (%)

Examples:
25126
stock
integer

Lagersaldo

Example:
1
stock_location
string

Valfritt: Lagerplats

disable_minusqty
string

Valfritt: Avaktivera minuslager

Examples:
10
visible
integer
Example:
1
description
string

Produktbeskrivning

gtin
string

Valfritt: EAN-nummer (GTIN)

supplier_name
string

Valfritt: Leverantörens namn

supplier_sku
string

Valfritt: Leverantörens artikelnummer

datafield_1
string

Valfritt: Datafält #1

datafield_2
string

Valfritt: Datafält #2

datafield_3
string

Valfritt: Datafält #3

seo_description
string

Valfritt: SEO beskrivning. Produktbeskrivning används om tom.

seo_title
string

Valfritt: SEO titel. Produkttitel används om tom.

Responses

200 OK

Produkten har skapats

Body
application/json
Object
success
integer
Example:
1
errors
Array of unknown
404 Fel

Ett fel inträffades.

500 Fel vid inläsning

Ett fel inträffades vid inläsningen.

Uppdatera enskild produkt (utifrån SKU)
Uppdatera flera produkter (utifrån SKU och IDs)
[
  {
    "sku": "SHIRT-123",
    "title": "T-shirt",
    "description":"<p><strong>This is so cool!</strong> Heee</p>",
    "supplier_name": "Shirt Factory",
    "supplier_sku": "SHIRT-WHITE-123",
    "datafield_1": "CustomData",
    "gtin": "Shirt-100BNMB"
  }
]
[
  {
    "sku": "SHIRT-123",
    "title": "ASUS",
    "title": "T-shirt",
    "description":"<p><strong>This is so cool!</strong> Heee</p>",
    "supplier_name": "Shirt Factory",
    "supplier_sku": "SHIRT-WHITE-123",
    "datafield_1": "CustomData",
    "gtin": "Shirt-100BNMB"
  },
  {
    "product_id": 1,
    "variant_id": 2,
    "price": 123
  },
  {
    "sku": "SHIRT-123",
    "price": 120
  }
]
Orders
GET /v1/orders
POST /v1/orders
PUT /v1/orders
Hämta beställningar
GET /v1/orders

Hämta butikens beställningar

Request parameters

order_id
string optional

Ordernummer för beställningen som önskas läsas in

from_date_paid
string optional

Fetch paid orders since a specific date. UNIX timestamp should be used here.

Example:
1596097247
to_date_paid
string optional

Fetch paid orders up to a specific date. UNIX timestamp should be used here.

Example:
1596097247
from_status_date
string optional

Fetch orders since a specific status transition date. UNIX timestamp should be used here.

Example:
1596097247
status
string optional

Fetch orders with a specific status. Can be used together with from_date_paid parameter.

Examples:
donepaiddone,paidunpaid
apps_load
boolean optional

Optional. Used together with a specific order_id and will return app specific order data (such as productproperties from the order).

Example:
true

Request body

Responses

200 OK

(med order id)

Body
Object
order_id
string
Example:
115
date_created
string
Example:
2020-01-01 12:01:45
status
string
Example:
-1
items_amount
string
Example:
398.00
shipping_amount
string
Example:
29.00
total_amount
string
Example:
427.00
discount_amount
unknown nullable
total_pay_amount
string
Example:
427.00
tax_amount
string
Example:
85.40
currency
string
Example:
SEK
shipping_name
string
Example:
Postnord
is_taxfree
boolean
products
Array
Object
product_id
string
Example:
34
title
string
Example:
T-shirt
price
string
Example:
199.00
qty
string
Example:
2
variant
unknown nullable
sku
string
Example:
34
customer
Object
email
string
Example:
dummy@email.com
phone
string
Example:
0123456789
customer_type
string
Example:
consumer
company_name
string
full_name
string
Example:
Sven Svensson
address
string
Example:
Vasatorpsvägen 147
address2
string
city
string
Example:
Munka-ljungby
zipcode
string
Example:
266 93
country
string
Example:
Sweden
paymethod
Object
method
string
Example:
klarna
transaction_id
string
Example:
XYZ1234567890
200 OK

(utan order id)

Body
Array
Object
order_id
string
Example:
12345
date_created
string
Example:
2020-07-29 11:35:39
total_amount
string
Example:
148.95
status
string
Example:
1
404 Kunde inte hittas
Specifik order
Nya beställningar, sedan datum.

Specifik beställning: 12345, fullständig orderinformation

GET http://api.quickbutik.com/v1/orders?order_id=12345 HTTP/1.1 

Content-Type: application/json

Ingen specifik beställning, förenklad orderinformation

GET https://api.quickbutik.com/v1/orders?from_date_paid=1596097247&status=1 HTTP/1.1 

Content-Type: application/json
Skapa ny beställning
POST /v1/orders

Skapa ny beställning och lägg till orderinformation. Status för nyskapade beställningar blir alltid obetald.

Request body

Array
Object
order_id
string

Must be of value create to create a new order.

Example:
create
customer
payment
shipping
products
products_add
products_remove
discount_add
discount_remove

Responses

200 OK
Body
Object
results
Object
create_1
Object
success
integer
Example:
1
new_order_id
integer
Example:
55213
checkout_url
string
Example:
https://checkout-url-here
JSON Request
CURL Request
POST https://api.quickbutik.com/v1/orders HTTP/1.1 

Content-Type: application/json

[
    {
        "order_id": "create",
        "customer": {
            "type": "business",
            "email": "kalle@anka.com",
            "phone_number": "+46123456789",
            "shipping_details": {
                "company_name": "Name AB",
                "firstname": "Kalle",
                "lastname": "Anka Ankesson",
                "address": "Gladagatan 10",
                "address2": "",
                "city": "Ankeborg",
                "zipcode": "12345",
                "country": "SE"
            }
        },
        "shipping": {
            "id": 1,
            "name": "Postnord Parcel Special"
        },
        "products": [
            {
                "sku": "SHIRT-123"
            }
        ]
    }
]
curl -X POST "http://api.quickbutik.com/v1/v1/orders"  \
 -H "Content-Type: application/json"  \
 -d '[
    {
        "order_id": "create",
        "customer": {
            "type": "business",
            "email": "kalle@anka.com",
            "phone_number": "+46123456789",
            "shipping_details": {
                "company_name": "Name AB",
                "firstname": "Kalle",
                "lastname": "Anka Ankesson",
                "address": "Gladagatan 10",
                "address2": "",
                "city": "Ankeborg",
                "zipcode": "12345",
                "country": "SE"
            }
        },
        "shipping": {
            "id": 1,
            "name": "Postnord Parcel Special"
        },
        "products": [
            {
                "sku": "SHIRT-123"
            }
        ]
    }
]'
Uppdatera beställning
PUT /v1/orders

Skapa ny obetald beställning och lägg till orderinformation.

Request body

Array
Object
order_id
string

Enter order_id you would like to update with content

Example:
12345
customer
payment
shipping
products
products_add
products_remove
discount_add
discount_remove

Responses

200 OK
Body
Object
results
Object
12345
Object

the updated order_id

order_id
integer
Example:
12345
success
integer
Example:
1
errors
Array of string
JSON Request
CURL Request
PUT https://api.quickbutik.com/v1/orders HTTP/1.1 

Content-Type: application/json

[
    {
        "order_id": 12345,
        "customer": {
            "type": "business",
            "email": "kalle@anka.com",
            "phone_number": "+46123456789",
            "shipping_details": {
                "company_name": "Name AS",
                "firstname": "Kalle",
                "lastname": "Anka Ankesson",
                "address": "Gladagatan 10",
                "address2": "",
                "city": "Ankeborg",
                "zipcode": "12345",
                "country": "SE, DK, NO"
            },
            "newsletter_subscribe": "true",
            "login_create": ""
        },
        "payment": {
            "method": "MySaleChannel",
            "transaction_id": ""
        },
        "shipping": {
            "id": 1,
            "name": "Postnord Parcel",
            "price": ""
        },
        "products": [
            {
                "sku": "SHIRT-123",
                "product_id": ""
            }
        ],
        "discount_add": {
            "amount": 100
        }
    }
]

HTTP/1.1 200 OK 

Content-Type: application/json

{
    "results": {
        "12345": {
            "order_id": 55750,
            "success": 1
        }
    }
}
curl -X PUT "http://api.quickbutik.com/v1/v1/orders"  \
 -H "Content-Type: application/json"  \
 -d '[
    {
        "order_id": 12345,
        "customer": {
            "type": "business",
            "email": "kalle@anka.com",
            "phone_number": "+46123456789",
            "shipping_details": {
                "company_name": "Name AS",
                "firstname": "Kalle",
                "lastname": "Anka Ankesson",
                "address": "Gladagatan 10",
                "address2": "",
                "city": "Ankeborg",
                "zipcode": "12345",
                "country": "SE, DK, NO"
            },
            "newsletter_subscribe": "true",
            "login_create": ""
        },
        "payment": {
            "method": "MySaleChannel",
            "transaction_id": ""
        },
        "shipping": {
            "id": 1,
            "name": "Postnord Parcel",
            "price": ""
        },
        "products": [
            {
                "sku": "SHIRT-123",
                "product_id": ""
            }
        ],
        "discount_add": {
            "amount": 100
        }
    }
]'
Ändra beställningsstatus
PUT /v1/orders

Ändra status på en eller flera beställningar och lägg till/aktivera tillhörande information.

Request body

Array
Object
order_id
string

Enter order_id you would like to update with content, or use value create to create a new order_id with content.

Example:
948102
status
string

Optional. Changes state of the order. Can only be used for a when order_id is specified (already created order).

Examples:
paiddonecancelled
shipping_info
Object

Valfritt: I samband med status done.

trackingnumber
string

Spårningsnummer

Example:
230491712300
company
string

Fraktföretag

Example:
DHL
email_confirmation
string

Valfritt: I samband med status done. Skicka fraktbekräftelse till kund?

Example:
true
skip_email_confirmation
string

Valfritt: I samband med status paid.

Example:
true
skip_webhook
string

Valfritt: I samband med status paid.

language
string

Valfritt: I samband med status paid. Two-letter language code (ISO 639-1).

Examples:
ensvda

Responses

200 OK
Body
Object
results
Object
1111
Object
order_id
integer
Example:
1111
errors
Array
string
Example:
Could not find order
success
string
Example:
0
2222
Object
order_id
integer
Example:
2222
success
string
Example:
1
Mark single order paid: Example 2
Mark single order paid: Example 1
Mark multiple orders paid
Mark multiple orders delivered
Mark multiple orders, different states.

Mark order paid. Order confirmation will be sent to customer.

[
  {
    "order_id": 55750,
    "status": "paid"
  }
]

Mark order paid. Order confirmation will NOT be sent to the customer (use case: if taken care of from the third party system).

[
  {
    "order_id": 55750,
    "status": "paid",
    "email_confirmation": false
  }
]
[
  {
    "order_id": 55750,
    "status": "paid",
    "email_confirmation": false
  },
  {
    "order_id": 55750,
    "status": "paid",
    "email_confirmation": false
  }
]
[
  {
    "order_id": 1111,
    "status": "done"
  },
  {
    "order_id": 2222,
    "status": "done",
    "shipping_info": {
      	"trackingnumber": "NAJ10192938",
      	"company": "Postnord"
    }
  }
]
[
  {
    "order_id": 1111,
    "status": "paid"
  },
  {
    "order_id": 2222,
    "status": "done",
    "shipping_info": {
      	"trackingnumber": "NAJ10192938",
      	"company": "Postnord"
    }
  },
  {
    "order_id": 3333,
    "status": "cancelled"
  }
]
Shippingmethods
GET /v1/shippingmethods
Hämta fraktsätt
GET /v1/shippingmethods

Hämta butikens fraktsätt

Request parameters

shipping_id
string optional

Optional. Enter if you would like to fetch a specific shipping_id.

Request body

Responses

200 OK
Body
Object
results
Array
Object
id
string
Example:
4
title
string
Example:
Postnord Företag
description
string
active
string
Example:
1
price
unknown nullable
price_basedon
string
Example:
weight
404 Kunde inte hittas
400 Bad Request
Paymentmethods
GET /v1/paymentmethods
Hämta betalsätt
GET /v1/paymentmethods

Hämta butikens betalsätt

Request parameters

paymentmethod_id
string optional

Optional. Enter if you would like to fetch a specific paymentmethod_id.

Request body

Responses

200 OK
Body
Object
results
Array
Object
paysystem_id
string
Example:
klarna3
customer_type
string
Example:
3
404 Kunde inte hittas
Categories
GET /v1/categories
POST /v1/categories
Hämta kategorier
GET /v1/categories

Hämta butikens kategorier

Request parameters

category_id
string optional

Optional. Enter if you would like to fetch data from a specific category_id.

Request body

Responses

200 OK
Body
Object
results
Object
category_id
integer
Example:
14
uri
string
Example:
sulor
url
string
Example:
/herr/skor/sulor
name
string
Example:
Sulor
name_path
string
Example:
Herr > Skor > Sulor
description1
unknown nullable
description2
unknown nullable
parent_id
integer

Returns NULL if this category is main

Example:
13
404 Kunde inte hittas
Skapa ny kategori
POST /v1/categories

Request body

application/json
Object
name
string required
Example:
Kablar
parent_id
integer nullable
Example:
112

Responses

201 Created
Body
Object
category_id
string
Example:
220
name
string
Example:
Kablar
uri
string
Example:
kablar
parent_id
string
Example:
112
Data Objects
Order
order.customer
Object
type
string
Examples:
consumerbusiness
email
string
Example:
kalle@anka.com
phone_number
string
Example:
+46123456789
shipping_details
Object
company_name
string

If customer.type is business, please specify a company_name.

Examples:
Bolaget ABCompany LLCName AS
firstname
string
Example:
Kalle
lastname
string
Example:
Anka Ankesson
address
string
Example:
Gladagatan 10
address2
string
city
string
Example:
Ankeborg
zipcode
string
Example:
12345
country
string

Two-letter country code (ISO 3166-1 alpha-2 format)

Example:
SE, DK, NO
newsletter_subscribe
string
Example:
true
login_create
string
Consumer
Business
{
    "type": "consumer",
    "email": "kalle@anka.com",
    "phone_number": "+46123456789",
    "shipping_details": {
        "firstname": "Kalle",
        "lastname": "Anka Ankesson",
        "address": "Gladagatan 10",
        "address2": "",
        "city": "Ankeborg",
        "zipcode": "12345",
        "country": "SE, DK, NO"
    },
    "newsletter_subscribe": "true",
    "login_create": ""
}
{
    "type": "business",
    "email": "kalle@anka.com",
    "phone_number": "+46123456789",
    "shipping_details": {
        "company_name": "Bolaget AB",
        "firstname": "Kalle",
        "lastname": "Anka Ankesson",
        "address": "Gladagatan 10",
        "address2": "",
        "city": "Ankeborg",
        "zipcode": "12345",
        "country": "SE, DK, NO"
    },
    "newsletter_subscribe": "true",
    "login_create": ""
}
order.payment
Object
method
string

Valfritt. Anges om köpet inte utförs i butikens checkout.

Example:
MySaleChannel
transaction_id
string

Valfritt. Order referens till betalsättet.

Payment through Checkout
Payment through External App

Leave as null or dont specify at all.

{
    "method": null,
    "transaction_id": null
}

Specify method and transaction_id for reference.

{
    "method": "MySaleChannel",
    "transaction_id": "ABC-QWERY-123456-1"
}
order.shipping
Object
id
integer

Shipping method ID (from the /shippingmethods available in the store)

Example:
1
name
string

Shipping method name (optional, uses title from shippingmethod otherwise if id specified)

Examples:
Postnord ParcelDHL Express
price
string

Shipping amount (optional, uses price from shippingmethod otherwise if id specified)

Example 1
{
    "id": 1,
    "name": "Postnord Parcel",
    "price": "49"
}
order.products

Specify products in this order. When used, all other existing products in the order will be removed and be replaced with the ones specified here.

Array

Specify products in this order. When used, all other existing products in the order will be removed and be replaced with the ones specified here.

Object
sku
string

Optional. You can use this parameter, or product_id/variant_id parameters, to identify product.

Example:
SHIRT-123
product_id
string
variant_id
string
Example:
NULL (no variant)
With SKU and IDs combined
With SKUs only
With IDs only
[
    {
        "sku": "SHIRT-123"
    },
    {
        "product_id": 10,
        "variant_id": 43
    },
    {
        "product_id": 10,
        "variant_id": null
    }
]

Specify the content of the order through SKUs only.

[
    {
        "sku": "SHIRT-123"
    },
    {
        "sku": "GLASS-456"
    },
    {
        "sku": "TIE-789"
    }
]
[
    {
        "product_id": 10
        "variant_id": 59
    },
    {
        "product_id": 11,
        "variant_id": 60
    },
    {
        "product_id": 329
    }
]
order.products_add

Optional. If you would like to add products from the order. You can pass multiple objects/products into this parameter, to add multiple at once.

Array

Optional. If you would like to add products from the order. You can pass multiple objects/products into this parameter, to add multiple at once.

Object
sku
string

Optional. You can use this parameter, or product_id/variant_id parameters, to identify product.

Example:
SHIRT-123
product_id
string
variant_id
string
Example:
NULL (no variant)
With SKUs and IDs combined
With SKUs only
[
    {
        "sku": "SHIRT-123"
    },
    {
        "product_id": 10,
        "variant_id": 43
    },
    {
        "product_id": 10,
        "variant_id": null
    }
]
[
    {
        "sku": "SHIRT-123"
    },
    {
        "sku": "GLASS-456"
    },
    {
        "sku": "TIE-789"
    }
]
order.products_remove

Optional. If you would like to remove products from the order. You can pass multiple objects/products into this parameter, to remove multiple at once.

Array

Optional. If you would like to remove products from the order. You can pass multiple objects/products into this parameter, to remove multiple at once.

Object
sku
string

Optional. You can use this parameter, or product_id/variant_id parameters, to identify product.

Example:
SHIRT-123
product_id
string
variant_id
string
Example:
NULL (no variant)
With SKUs and IDs combined
With SKUs only
[
    {
        "sku": "SHIRT-123"
    },
    {
        "product_id": 10,
        "variant_id": 43
    },
    {
        "product_id": 10,
        "variant_id": null
    }
]
[
    {
        "sku": "SHIRT-123"
    },
    {
        "sku": "GLASS-456"
    },
    {
        "sku": "TIE-789"
    }
]
order.discount_add

Optional. Set only if you would like to add a discount for this order.

Object

Optional. Set only if you would like to add a discount for this order.

amount
number

Valfritt. Ange rabattvärde.

Example 1

Specify if you would like to add a discount value on the order.

{
    "amount": 100
}
order.discount_remove

Optional. Set only if you would like to add a discount for this order.

boolean

Optional. Set only if you would like to add a discount for this order.

Example 2

Boolean (true) if you would like to remove the current discount added for the order.

true
Webhooks
Introduktion

Webhooks kan aktiveras av butiksägaren i Quickbutiks kontrollpanel.

En webhook kan ses som en tekniskt notis eller “pling” som talar om för en tredjepart att en viss händelse har inträffats. Det kan vara en ny beställning eller dylikt. En händelse kallar vi Event och Events kan skicka Webhooks (notis om en händelse) till en/flera angivna länkadresser.

Samtliga Events skickas med GET-parametrar, alltid bestående av minst event_type som talar om vad det är för händelse.

Webhooks används oftast i samband med API för att få nödvändig kompletterande information.

Exempel

  • Webhook med Event Ny beställning tas emot. Mottagaren har fått ett ordernummer som nu kan användas för att läsa in fullständiga beställningen via API:et.
Events

Tillgängliga Events:

order

  • event_type: order.new

Ny beställning (betald). Skickas med parameter order_id.

  • event_type: order.done

Beställning har markerats klar (skickad). Skickas med parameter order_id.

  • event_type: order.cancelled

Beställning har markerats avbruten (av butiksägaren). Skickas med parameter order_id.