External Api v2
Gælder for alle kald:
Fejlkoder er i form af http status koder.
403 Forbidden Firmaid og token er ugyldige; betyder at du ikke har tilladelse til kaldet eller hashen ikke er korrekt.
Ved 403 er der typisk en nærmere forklaring for fejen i svarets body. 500 Internal Server Error; betyder der er sket en anden uventet fejl
Gælder for campaign api kald:
Når JSON er valgt som responstype
Ved et successfuldt kald returneres et json objekt med følgende struktur:
content_copy
{ "status": "Card successfully Activated!" }
Hvor status kan enten være en besked om handlingen der blev udført, eller andet forventet svar fra kaldet. Herunder er et eksempel fra campaignList.
content_copy
{ "status": { "Campaigns": [ { "campaign": { "campaignID": 26, "campaignName": "asd", "free_split": 0, "free_msg": 0, "auto_add": 0, "info_view": 0 } }, ] }
Ved et fejlet kald returneres et json objekt med følgende struktur:
content_copy
{ "ERROR": "Unknown Card - ActivateCard" }
Hvor ERROR er en fejbesked samt hvilket kald fejlen er sket ved. I dette eksempel er fejlen sket ved “ActivateCard” kaldet.
API calls for Product functionality
Get products
Request headers
Responses
OK
Body
The product id
The product name
The product group id
The product group name
Price 1
Price 2
Price 3
Price 4
Price 5
The cost price
The standard price
list of categories the product appears in
the id of the category
the name of the category
array of pricegroups indexed by their group number
individual group number for each pricegroup
Product description
Examples
JSON Response
[
{
"ID": 1,
"name": "",
"groupid": "",
"groupname": "",
"price_1": "",
"price_2": "",
"price_3": "",
"price_4": "",
"price_5": "",
"cost_price": "",
"standard_price": "",
"categories": [
{
"category_id": "",
"category_name": ""
}
],
"additional_price_groups": {
"6": {
"price": "25",
"name": "middag"
}
"8": {
"price": "60",
"name": "aften"
}
},
"description": ""
}
]
XML Response
<?xml version="1.0" encoding="ISO-8859-1"?>
<list>
<products>
<product id="0">
</product>
<product_group id="0">
</product_group>
<price price_1="string" price_2="string" price_3="string" price_4="string" price_5="string">
</price>
<indkbspris>string</indkbspris>
<categories>
<category id="123" name="category_1" />
<category id="456" name="category_1" />
</categories>
<additional_price_groups>
<price_group id="6" price="25" name="middag" />
<price_group id="8" price="60" name="aften" />
</additional_price_groups>
<normalpris>string</normalpris>
<description></description>
</products>
</list>
Create a new product
Request headers
Request body
HMAC hash of the request values Read more
The produkt name
The name of the product group the product should belong to. A new group will be created if the name does not exsist.
The price of the produkt
The cost price of the product
Responses
Body
Examples
Successfull response returns a status message
<?xml version="1.0" encoding="ISO-8859-1"?>
<status> Product 123456 created </status>
Unsuccessfull response returns a fail with a message
<?xml version="1.0" encoding="ISO-8859-1"?>
<fail> No product name </fail>
POST https://api.onlinepos.dk/api/addProduct HTTP/1.1
token: <company token>
firmaid: <company id>
Content-Type: application/x-www-form-urlencoded
hash=
&productname=
&productgroup=Sodavand
&price=15
&costprice=6
Get products
Request headers
Responses
OK
Body
List of active product groups
ID of product group
Name of product group
Description of product group
List of products in product group
ID of product
Name of Product
Price of product
Description of product
Cost price of product
Product Categories of product
ID of category
Name of category
Custom PLU 1
Custom PLU 2
ID of the Master of this product. (0 means no master)
Other registered prices (if any exists)
Pricegroup number
Name of pricegroup
Price of product when pricegroup is active
If the product is a split product (it contains sub products), then this list shows its content.
ID of sub product
Amount of sub product added
Total sales price of sub products (line price, not a unit price)
If the product is a MSG product, then this contains the ID of the MSG page connected to the product
List of all MSG pages
ID of MSG Page
Name of MSG page
Minimum number of selections required
Maximum number of selections allowed
If this field is present, then the total price of all selections should be this value
If field is present, contains the Product ID(s) of default selections.
List of Product ID’s available for selection
Examples
JSON Response
API calls for Sales functionality
{from}
/{to}
{from}
/{to}
{date}
{orderid}
{from}
/{to}
Get list of debtor sales
Path variables
Start of the period in unix time
End of the period in unix time
Request headers
Responses
{from}
/{to}
There can be multiple locations
Path variables
Start of the period in unix time
End of the period in unix time
Request headers
Responses
Body
2016.01.01 00:00:00 - 2018.07.24 00:00:00
Examples
Xml
<?xml version="1.0" encoding="ISO-8859-1"?>
<XML>
<period>string</period>
<location>
<userId>1</userId>
<amount>2</amount>
<pax>2</pax>
</location>
</XML>
Json
{
"period": "2016.01.01 00:00:00 - 2018.07.24 00:00:00",
"location": [
{
"userid": 1,
"amount": 1.1,
"pax": "0"
}
]
}
Get list of sales for a specific department or cardnumber
Request headers
Request body
Unix time
Unix time represents the seconds passed since Jan 01 1997.
Using unix time
Most programming languages have built in functions for converting a date to unix time.
You can also use an online tool like unixtimestamp.com
Start of the period in unix time
End of the period in unix time
Get all sales from a specific terminal or group of terminals. Department is the name of the terminal(s)
Get all sales from a specific cardnumber
Whether to map product- and group-ids to the koncern ids
Responses
Response in JSON
Body
dd.mm.yyyy
hh:mm
If map_to_koncern is enabled this will show the id from the koncern
If map_to_koncern is enabled this will show the id from the koncern
The method of payment for the sale.
Number of guests involved with the sale.
The terminal or group of terminals a sale was made from.
Product id
Manufacturer product id
Examples
Successfull response returns an array of lines representing individual sales
{
"sales": [
{
"line": {
"id": 1,
"chk": 1,
"date": "15.03.2016",
"time": "17:00",
"product_id": 1,
"product": "",
"product_group_id": 1,
"product_group": "",
"amount": 1,
"price": "10,00",
"payment_type": "",
"clerk": "",
"pax": 1,
"department": "",
"ean_1": "",
"ean_2": "",
"ean_3": "",
"ean_4": ""
}
}
]
}
Unsuccessfull response returns an error key with a message
{
"error": "Input fail!"
}
Response in XML (Default)
POST https://api.onlinepos.dk/api/exportSales HTTP/1.1
token: <company token>
firmaid: <company id>
Content-Type: application/x-www-form-urlencoded
Accept: application/json
from=1597141149
&to=1597100000
&department=kasse 1
&cardnumber=1234567890
Get extended list of sales grouped by order lines
Request headers
Responses
Body
Timestamp for payment of the order line
Timestamp for when order is created
The ID of the order line
The ID of the order that the order line is related to
OnlinePOS check number
The ID of the product on the order line
The name of the product on the order line
Account
ID of the Master of this product. (0 means no master)
Account number
The ID of the product group that the product is related to
The name of the product group that the product is related to
EAN 1
EAN 2
EAN 3
EAN 4
The amount of product sold on the order line
The price/value of the order line
The price/value of the order line excl. VAT
The cost price of the product
The VAT rate related to the order line
The discount given on the order line
The payment type for the order line
The payment type ID for the order line
The clerk who received payment for the order line
The order number that the order line is related to
The number of guests registred on the order
The table number that the order line is related to
The terminal that the order line is sold on
The OnlinePOS customer number that the order line is registred on
The name of the company
Card number
The country that the card is related to
OnlinePOS pnumber (employee number)
The debtor number
The name of the debtor
Examples
{
"current_page": 1,
"data": [
{
"datetime": "2014-03-08 00:09:20",
"timestamp_pay": "2014-03-08 00:09:20",
"timestamp_order": "2014-03-08 00:09:20",
"orderlineid": 23410534,
"orderid": 15039525,
"chkno": 2039,
"productid": 74631,
"productname": "Stor Fadøl - BAR",
"account": "1616",
"MasterID" : 0,
"accountnumber": "1010",
"productgroupid": 4109,
"productgroup": "Øl - BAR",
"ean_1": "649528775290",
"ean_2": "",
"ean_3": "",
"ean_4": "",
"count": 1,
"price": 45,
"priceexclvat": 45,
"costprice": 1,
"vatrate": "",
"discount": 1,
"paymenttype": "Kontant",
"paymenttypecode": "k",
"clerk": "0",
"ordernumber": 2039,
"pax": 1,
"pid": "",
"table": "",
"department": "Kasseterminal",
"firmaid": 9000,
"companyname": "OnlinePOS Udvikling",
"cardnumber": "",
"cardcountry": "",
"pnumber": "0",
"debtornumber": "",
"debtorname": ""
}
],
"from": 1,
"next_page_url": "http://api.onlinepos.dk/api/exportSales/v20?page=2",
"path": "http://api.onlinepos.dk/api/exportSales/v20",
"per_page": 10000,
"prev_page_url": "http://api.onlinepos.dk/api/exportSales/v20?page=1",
"to": 10000
}
{date}
Get extended list of sales grouped by order lines and date
Path variables
Get data from date and forward. type UNIX Timestamp
Request headers
Responses
Body
Timestamp for payment of the order line
Timestamp for when order is created
The ID of the order line
The ID of the order that the order line is related to
OnlinePOS check number
The ID of the product on the order line
The name of the product on the order line
Account
ID of the Master of this product. (0 means no master)
Account number
The ID of the product group that the product is related to
The name of the product group that the product is related to
EAN 1
EAN 2
EAN 3
EAN 4
The amount of product sold on the order line
The price/value of the order line
The price/value of the order line excl. VAT
The cost price of the product
The VAT rate related to the order line
The discount given on the order line
The payment type for the order line
The payment type ID for the order line
The clerk who received payment for the order line
The order number that the order line is related to
The number of guests registred on the order
The table number that the order line is related to
The terminal that the order line is sold on
The OnlinePOS customer number that the order line is registred on
The name of the company
Card number
The country that the card is related to
OnlinePOS pnumber (employee number)
The debtor number
The name of the debtor
Examples
{
"current_page": 1,
"data": [
{
"datetime": "2014-03-08 00:09:20",
"timestamp_pay": "2014-03-08 00:09:20",
"timestamp_order": "2014-03-08 00:09:20",
"orderlineid": 23410534,
"orderid": 15039525,
"chkno": 2039,
"productid": 74631,
"productname": "Stor Fadøl - BAR",
"account": "1616",
"MasterID" : 0,
"accountnumber": "1010",
"productgroupid": 4109,
"productgroup": "Øl - BAR",
"ean_1": "649528775290",
"ean_2": "",
"ean_3": "",
"ean_4": "",
"count": 1,
"price": 45,
"priceexclvat": 45,
"costprice": 1,
"vatrate": "",
"discount": 1,
"paymenttype": "Kontant",
"paymenttypecode": "k",
"clerk": "0",
"ordernumber": 2039,
"pax": 1,
"pid": "",
"table": "",
"department": "Kasseterminal",
"firmaid": 9000,
"companyname": "OnlinePOS Udvikling",
"cardnumber": "",
"cardcountry": "",
"pnumber": "0",
"debtornumber": "",
"debtorname": ""
}
],
"from": 1,
"next_page_url": "http://api.onlinepos.dk/api/exportSales/v20?page=2",
"path": "http://api.onlinepos.dk/api/exportSales/v20",
"per_page": 10000,
"prev_page_url": "http://api.onlinepos.dk/api/exportSales/v20?page=1",
"to": 10000
}
{orderid}
Get extended list of sales grouped by order lines and starting order ID
Path variables
Get data from order id and forward
Request headers
Responses
Body
Timestamp for payment of the order line
Timestamp for when order is created
The ID of the order line
The ID of the order that the order line is related to
OnlinePOS check number
The ID of the product on the order line
The name of the product on the order line
Account
ID of the Master of this product. (0 means no master)
Account number
The ID of the product group that the product is related to
The name of the product group that the product is related to
EAN 1
EAN 2
EAN 3
EAN 4
The amount of product sold on the order line
The price/value of the order line
The price/value of the order line excl. VAT
The cost price of the product
The VAT rate related to the order line
The discount given on the order line
The payment type for the order line
The payment type ID for the order line
The clerk who received payment for the order line
The order number that the order line is related to
The number of guests registred on the order
The table number that the order line is related to
The terminal that the order line is sold on
The OnlinePOS customer number that the order line is registred on
The name of the company
Card number
The country that the card is related to
OnlinePOS pnumber (employee number)
The debtor number
The name of the debtor
Examples
{
"current_page": 1,
"data": [
{
"datetime": "2014-03-08 00:09:20",
"timestamp_pay": "2014-03-08 00:09:20",
"timestamp_order": "2014-03-08 00:09:20",
"orderlineid": 23410534,
"orderid": 15039525,
"chkno": 2039,
"productid": 74631,
"productname": "Stor Fadøl - BAR",
"account": "1616",
"MasterID" : 0,
"accountnumber": "1010",
"productgroupid": 4109,
"productgroup": "Øl - BAR",
"ean_1": "649528775290",
"ean_2": "",
"ean_3": "",
"ean_4": "",
"count": 1,
"price": 45,
"priceexclvat": 45,
"costprice": 1,
"vatrate": "",
"discount": 1,
"paymenttype": "Kontant",
"paymenttypecode": "k",
"clerk": "0",
"ordernumber": 2039,
"pax": 1,
"pid": "",
"table": "",
"department": "Kasseterminal",
"firmaid": 9000,
"companyname": "OnlinePOS Udvikling",
"cardnumber": "",
"cardcountry": "",
"pnumber": "0",
"debtornumber": "",
"debtorname": ""
}
],
"from": 1,
"next_page_url": "http://api.onlinepos.dk/api/exportSales/v20?page=2",
"path": "http://api.onlinepos.dk/api/exportSales/v20",
"per_page": 10000,
"prev_page_url": "http://api.onlinepos.dk/api/exportSales/v20?page=1",
"to": 10000
}
API calls for Card functionality
{cardnumber}
{debtor}
/{type}
/{offset}
{cardnumber}
{offset}
{firmaid}
/{from}
/{to}
{cardnumber}
{cardnumber}
Get card info from card number
Path variables
The card number
Request headers
Responses
OK
Body
Examples
Xml
<?xml version="1.0" encoding="ISO-8859-1"?>
<list>
<card>
<id>1</id>
<name>John Smith</name>
<phone>88888888</phone>
<email>example@email.com</email>
<debtor></debtor>
<cardgroup> Kvartkort </cardgroup>
<RFID></RFID>
<cardnumber>090000100000000</cardnumber>
<cardtype>Default</cardtype>
<balance>100,00</balance>
<deleted>yes</deleted>
</card>
</list>
Json
[
{
"id": 1,
"name": "",
"phone": 1,
"email": "example@email.com"
"debtor": "",
"cardgroup": "",
"RFID": "",
"cardnumber": "",
"cardtype": "",
"balance": "",
"deleted": ""
}
]
{debtor}
/{type}
/{offset}
Get card list by debtor and type, return 1000 cards start from offset
Path variables
Customer’s debtor number
The type must be between 1-3
Staff card
Prepaid card
Giftcard
if not set default = 0
Request headers
Responses
OK
Body
Examples
Xml
<?xml version="1.0" encoding="ISO-8859-1"?>
<list>
<card>
<id>0</id>
<name>string</name>
<phone>string</phone>
<debtor>string</debtor>
<cardgroup>string</cardgroup>
<RFID>string</RFID>
<cardnumber>string</cardnumber>
<cardtype>string</cardtype>
<balance>string</balance>
<deleted>string</deleted>
</card>
</list>
Json
[
{
"id": 1,
"name": "",
"phone": 1,
"debtor": "",
"cardgroup": "",
"RFID": "",
"cardnumber": "",
"cardtype": "",
"balance": "",
"deleted": ""
}
]
{cardnumber}
Get card info for a card within the koncern.
Path variables
The card number
Request headers
Responses
OK
Body
The card id
The card name
The card holders phone
The card pin code
The card group
The cards RFID if it has one
The card number
The type of card
The balance on the card if it has one
Examples
Xml
<?xml version="1.0" encoding="ISO-8859-1"?>
<card>
<id>0</id>
<name>string</name>
<phone>string</phone>
<debtor>string</debtor>
<pinkode>string</pinkode>
<cardgroup>string</cardgroup>
<RFID>string</RFID>
<cardnumber>string</cardnumber>
<cardtype>string</cardtype>
<balance>string</balance>
</card>
Json
{
"id": "",
"name": "",
"phone": "",
"debtor": "",
"pinkode": "",
"cardgroup": "",
"RFID": "",
"cardnumber": "",
"cardtype": "",
"balance": ""
}
{offset}
Returns 1000 cards, starting from the defined offset. Offset default is 0.
Path variables
if not set default = 0
Request parameters
Filter results to only show cards with this registered email
Filter results to only show cards with this registered phone number
Request headers
Responses
OK
Body
Examples
Xml
<?xml version="1.0" encoding="ISO-8859-1"?>
<list>
<card>
<id>1</id>
<name>John Smith</name>
<phone>88888888</phone>
<email>example@email.com</email>
<debtor></debtor>
<cardgroup> Kvartkort </cardgroup>
<RFID></RFID>
<cardnumber>090000100000000</cardnumber>
<cardtype>Default</cardtype>
<balance>100,00</balance>
<deleted>yes</deleted>
</card>
<card>
<id>2</id>
<name>John Smith</name>
<phone>88888888</phone>
<email>example@email.com</email>
<debtor></debtor>
<cardgroup>Personale</cardgroup>
<RFID></RFID>
<cardnumber>9000010000</cardnumber>
<cardtype>Default</cardtype>
<balance>100,00</balance>
<deleted>no</deleted>
</card>
</list>
Json
[
{
"id": 1,
"name": "",
"phone": 1,
"email": "",
"birthday": 19950101,
"debtor": "",
"discount": "20",
"cardgroup": "",
"RFID": "",
"cardnumber": "",
"cardtype": "",
"balance": "",
"deleted": ""
}
]
Get a list of cards for a customer/koncern with extended card information on each card. Koncern-feature needs to be enabled on the customer to find cards throughout the koncern.
Request parameters
Only list cards with a card number existing in this comma separated list.
012341234123413,012341234123414
Only list cards with card numbers equal to or higher than this card number.
Only list cards with card numbers equal to or lower than this card number.
Only list cards with a card group name existing in this comma separated list.
VIP,Special guest
If closed cards should be included in the list or not.
The current page in a paginated results.
Request headers
Responses
A non-paginated result was returned.
Body
The card’s database id
The card’s number
The name of the card’s owner
The phone number of the card’s owner
The card’s debtor
The card’s pincode
The card’s RFID
The name of the card’s card group
The card’s price group
The card’s discount in pct
The firmaid the card belongs to. Only given when a card is in a koncern.
The id of the waiter
The card’s balance
The card’s type. Se values in examples.
False if the card is active. True if the card is closed or deleted. Note that “closed” cards will only appear if lookForClosed = true in request.
No cards were found with the filters used!
A paginated result was returned. Page size = 50.
Body
The total number of pages in the paged result
The number of cards in every page of the paged result
The current page returned in the page result
The last page in the paged result
The cards of the current page in the paged result
The card’s database id
The card’s number
The name of the card’s owner
The phone number of the card’s owner
The card’s debtor
The card’s pincode
The card’s RFID
The name of the card’s card group
The card’s price group
The card’s discount in pct
The firmaid the card belongs to. Only given when a card is in a koncern.
The id of the waiter
The card’s balance
The card’s type. Se values in examples.
False if the card is active. True if the card is closed or deleted. Note that “closed” cards will only appear if lookForClosed = true in request.
Bad input was set in one of the parameters.
Hash Not Matching! or You don’t have access to this call! or User not found!
Get a list cards with status(incl. closed) in the koncern of the company with no 1234, where the card group is either “VIP” or “Special guest” and the card number is equal to or higher than “012341234123413”. Show page 2 of the paginated result.
GET https://api.onlinepos.dk/api/getStatusOfCards?from_number=012341234123413&look_for_closed=1&page=7&groups=VIP,Special guest HTTP/1.1
token: 8cd120a338e7b0335c5c2f853ac55f2aa459e5ca64013c48d0043935202672f1
firmaid: 1234
hash: 99a4d576af9d21bfb535a1df7018064fc16ac5ecf21fbbf5985bb7079b09a68f
HTTP/1.1 206 Partial Content
Content-Type: application/json
{
"look_for_closed": "1",
"groups": "VIP,Special guest",
"from_number": "012341234123413",
"pagination": {
"total": 51,
"per_page": 50,
"current_page": 2,
"last_page": 2
},
"cards": [
{
"id": 1234,
"name": "Fornavn Efternavn",
"phone": "+45 12345678",
"debtor": "",
"pinkode": "1234",
"RFID": "",
"cardnumber": "012341234123414",
"cardgroup": "VIP",
"balance": "120.00",
"cardtype": "Default"
}
]
}
Get a list of cards for a customer/koncern with campaign information on each card. Koncern-feature needs to be enabled on the customer to find cards throughout the koncern.
Request parameters
Only list cards with a card number existing in this comma separated list.
012341234123413,012341234123414
Only list cards with card numbers equal to or higher than this card number.
Only list cards with card numbers equal to or lower than this card number.
Only list cards with a card group name existing in this comma separated list.
VIP,Special guest
If closed cards should be included in the list or not.
The current page in a paginated results.
Request headers
Responses
A non-paginated result was returned.
Body
The card number
The name on the card
The card’s RFID no
The phone number on the card
The status of the card. “Active” or “Closed”
The firmaid the card belongs to. Only given when a card is in a koncern.
The card group the card belongs to - if any
Points listed by campaign
The name of the campaign
The unique id of the campaign
The current number of points for this campaign
No cards were found with the filters used!
A paginated result was returned. Page size = 50.
Body
The total number of pages in the paged result
The number of cards in every page of the paged result
The current page returned in the page result
The last page in the paged result
The cards of the current page in the paged result
The card number
The name on the card
The card’s RFID no
The phone number on the card
The status of the card. “Active” or “Closed”
The firmaid the card belongs to. Only given when a card is in a koncern.
The card group the card belongs to - if any
Points listed by campaign
The name of the campaign
The unique id of the campaign
The current number of points for this campaign
Bad input was set in one of the parameters.
Hash Not Matching! or You don’t have access to this call! or User not found!
Create a new staffcard, prepaid card or giftcard.
Request headers
Request body
HMAC hash of the request values Read more
The card type, 1 = standard card, 2 = prepaid card, 3 = giftcard
The new card name
The new card phone number
The new card debtor number. (Must be unique)
RFID for the card
Ekspedient number. (Must be unique)
0 or 1, if 1 use cardnumber as pnr
0 or 1, if 1 use debtor as pnr
The name of the group the card should belong to. A new group will be created if the name does not exist.
Only relevant if Staff Card. (Must be 6 digits or less)
The id of the price group the card will order products from
The discount of the card in percentage.
The cardholders email address
The cardholders birthdate (formatted as yyyymmdd)
Block the card for being use for payment. 1 to block card and 0 to not block. Default is 0
Responses
OK
Body
Examples
Successfull response returns the cardnumber.
<?xml version="1.0" encoding="ISO-8859-1"?>
<cardnumber> 1234567890 </cardnumber>
Unsuccessfull response returns a fail with a message.
<?xml version="1.0" encoding="ISO-8859-1"?>
<fail> eksnr is not unique! </fail>
POST https://api.onlinepos.dk/api/addCard HTTP/1.1
token: <company token>
firmaid: <company id>
Content-Type: application/x-www-form-urlencoded
hash=
&type=1
&name=
&phone=
&debtor=
&rfid=
&eksnr=1
&allow_manual_input=1
&use_debtor_input=1
&group=
&pin_code=
&price_group=1
&discount=25
&email=
&birthday=19991205
Create multible cards at the same time. The limit is creating 1000 cards at the same time.
Request headers
Request body
List of card to make
HMAC hash of the request values Read more
The card type, 1 = standard card, 2 = prepaid card, 3 = giftcard
The new card name
The new card phone number
The new card debtor number. (Must be unique)
RFID for the card, if set it will be the cardnumber of the card to
Only relevant if standard card(type 1). Ekspedient number. (Must be unique)
0 or 1, if 1 use cardnumber as pnr
0 or 1, if 1 use debtor as pnr
The name of the group the card should belong to. A new group will be created if the name does not exist.
Only relevant if standard card (type 1). (Must be 6 digits or less)
The id of the price group the card will order products from
The discount of the card in percentage.
The cardholders email address
The cardholders birthdate (formatted as yyyymmdd)
Block the card for being use for payment. 1 to block card and 0 to not block. Default is 0
Examples
{
"cards": [
{
"hash": "nvsdajknbvijodsafbha",
"type": 3,
"name": "TestCard",
"phone": "88888888",
"debtor": "09090",
"rfid": "90003000010",
"eksnr": "1",
"allow_manual_input": 1,
"use_debtor_input": 1,
"group": "1",
"pin_code": "1234",
"price_group": 1,
"discount": 25,
"email": "test@onlinepos.dk",
"birthday": 19810220,
"block_card_payment": 1
}
]
}
Responses
Body
Examples
Response when JSON is valid cardNumber is empty on fail. Name and rfid is empty when not send with in request
[
{
"status": "fail",
"error": "RFID is not unique!",
"name": "BulkTestP0",
"rfid": "90000",
"cardNumber": ""
},
{
"status": "success",
"error": "",
"name": "BulkTestP1",
"rfid": "900030001",
"cardNumber": "900030001"
}
]
Response when json is invalid The number tells what part of the JSON is invalid So cards.0.hash is the hash in the first card in the cards list
{
"status": "ERROR",
"error": "The cards.0.hash field is required."
}
Edit an existing card
Request headers
Request body
HMAC hash of the request values Read more
The carnumber of desired card you want to modify
The new name for card
The new phone number for card
The new debtor number for card
The new RFID for card
The id of the group the card should be moved to.
Set true if you want to delete card
The cardholders email address
The cardholders birthdate (formatted as yyyymmdd)
The discount of the card in percentage.
Examples
Responses
Body
Examples
Successfull response returns a status message
<?xml version="1.0" encoding="ISO-8859-1"?>
<status> Card 1234567890 successfully updated! </status>
Unsuccessfull response returns a fail with a message
<?xml version="1.0" encoding="ISO-8859-1"?>
<fail> Unknown cardnumber - edit </fail>
POST https://api.onlinepos.dk/api/editCard HTTP/1.1
token: <company token>
firmaid: <company id>
Content-Type: application/x-www-form-urlencoded
hash=
&cardnumber=1234567890
&name=
&phone=
&debtor=
&rfid=
&group=
&delete=
&email=
&birthday=19991205
Edit multiple cards at the same time. Cards can be edited throught the koncern the customer belongs to(if any), but koncern-feature needs to be enabled on the customer to edit cards throughout the koncern.
Request headers
Request body
Firmaid at OnlinePOS. Must match the one sent in the header.
The updates per card that is to be made.
The number of the card to update
The updates that is to be made on a card
Update the card’s RFID no
Update the owner of the card’s name
Update the owner of the card’s phone number
Update the owner of the card’s email
Update the owner of the card’s birthday
Update the id of the card’s card group
Update the card’s discount(in pct)
Update the no of the card’s price group
Update the card’s balance
If the card needs to be deleted. 0 = No, 1 = Yes.
Responses
Body
The updates per card that was to be made. Incl. status.
A number that representat an info/error message.
Card was updated
Card was deleted
Card was already updated
Card was not found.
No updates was given for this card
Information was missing on whether to update or deleted the card
Birthday is not formatted correctly
Birthday is not a valid date in the calendar
RFID is not unique
Debtor number is not unique
A group with this id doesn’t exist
Failed validation of input for update.
Other. See a more specific error code in ‘message’.
The value of a field wasn’t updated.
An info/error message.
The firmaid the card belongs to. Only given when a card is in a koncern.
Deposit a value to a specific card
Request headers
Request body
HMAC hash of the request values Read more
The card number
The amount you want to deposit
Use this parameter to set the cards balance to amount. Default behaviour the balance is modified by amount.
Responses
OK
Body
Examples
Successfull response returns a status with the new balance
<?xml version="1.0" encoding="ISO-8859-1"?>
<status> New balance: XX.XX </status>
Unsuccessfull response returns a fail with a message
<?xml version="1.0" encoding="ISO-8859-1"?>
<fail> Unknown cardnumber: 1234567890 - Deposit </fail>
POST https://api.onlinepos.dk/api/deposit HTTP/1.1
token: <company token>
firmaid: <company id>
Content-Type: application/x-www-form-urlencoded
hash=
&cardnumber=1234567890
&amount=10
&overwrite_balance=true
Create a new voucher
Request headers
Request body
Hash of the data
Name of the new voucher
Voucher number, must be unique
Id of the campaign the voucher is associated with
Date the voucher is valid from. Following the format YYYYMMDD
Date the voucher is valid to. Following the format YYYYMMDD
Responses
When using JSON response
Body
Examples
Successful operation
{
"status": "Voucher created",
"cardnumber": "1000000007"
}
Failed operation
{
"ERROR": "voucherno is not unique!"
}
Body
Examples
Successfull operation
Failed operation
Incorrect credentials, privledges or hash.
Create multipe vouchers from an interval of card numbers
Request headers
Request body
Hash of the data. Data order: token, firmaid, voucherNoFrom, voucherNoTo, name, campaignid, points, startDate and endDate. Read more
Start card number for voucher
End card number for voucher
Amount of points on voucher/card
Id of campaign the voucher/card is part of
Name of the voucher/card. Default is Gavekort
Start date for voucher/card to be active if the is one. Format is YYYYMMDD
End date for voucher/card to be active if the is one. Format is YYYYMMDD
Examples
Example of json body
{
"hash": "Test",
"voucherNoFrom": "10000",
"voucherNoTo": "15000",
"points": 10,
"campaignid": 26,
"name": "Test",
"startDate": 20210304,
"endDate": 20210304
}
Responses
Body
Status of call can be Vouchers created or ERROR
Error message, error is only the if status is ERROR
Examples
On Error
{
"status": "ERROR",
"error": "Hash Not Matching!"
}
On Succes
{
"status": "Vouchers created"
}
{firmaid}
/{from}
/{to}
Get a list of deposits and withdrawals per card in the given time period.
Path variables
Customer number
From time as unix timestamp
to time as unix timestamp
Request headers
Responses
OK
Body
Examples
Returns a list with an entry for each used card.
[
{
"cardnumber": "000230300000001",
"cardname": "Giftcard",
"deposit": "2927.30",
"withdrawal": "2927.30",
"subtotal": "0.00"
},
{
"cardnumber": "000230300000002",
"cardname": "Giftcard",
"deposit": "900.00",
"withdrawal": "-566.00",
"subtotal": "334.00"
}
]
{cardnumber}
Get historic data for all balance changes on the given card.
Path variables
Card number
Request headers
Responses
OK
Body
Examples
Returns a list with an entry for each card balance change.
[
{
"date": "2019-03-06 10:21:52",
"type": "Purchase",
"amount": 60,
"location": "Test Venue,
"receipt": {
"receipt_product_lines": [
{
"qty": 1,
"tekst": "Test Produkt",
"price": "65.00",
"discount": "0.00"
}
],
"receipt_payment_lines": [
{
"payment_type": "Betalingskort",
"amount": "20.00"
},
{
"payment_type": "Gavekort",
"amount": "60.00"
}
]
}
}
]
{campaign_id}
{campaignid}
Request parameters
Whether or not to show inactive campaigns
Request headers
Responses
Body
List of campaigns
Id of campaign
Name of campaign
whether the campaign is active or not
The type of the campaign (amount, price, points)
List of company ids the campaing works on.
[1,2]
Examples
{
"Campaigns": [
{
"campaign": {
"campaignID": 1,
"campaignName": "",
"active": 1,
"type": "points",
"free_split": 1,
"free_msg": 1,
"auto_add": 1,
"info_view": 1
}
}
]
}
GET https://api.onlinepos.dk/api/campaign/campaignList?show_inactive=0 HTTP/1.1
token: <company token>
firmaid: <company id>
HTTP/1.1 200 OK
Content-Type: application/json
{
"Campaigns": [
{
"campaign": {
"campaignID": 1,
"campaignName": "",
"active": 1,
"type": "points",
"free_split": 1,
"free_msg": 1,
"auto_add": 1,
"info_view": 1
}
}
]
}
{campaign_id}
Path variables
The campaign id you wish to look up products for
Request headers
Responses
Body
List of reward products
The cost to activate the campaign deal
The price of the product after activation
list of collection products
The reward for buying the product
Examples
{
"reward_products": [
{
"product_id": 1,
"product_name": "Lille Fadøl",
"cost": 1,
"campaign_price": 1
}
],
"collection_products": [
{
"product_id": 2,
"product_name": "burger",
"reward": 1
}
]
}
GET https://api.onlinepos.dk/api/campaign/campaignProducts/99 HTTP/1.1
token: <company token>
firmaid: <company id>
HTTP/1.1 200 OK
Content-Type: application/json
{
"reward_products": [
{
"product_id": 1,
"product_name": "Lille Fadøl",
"cost": 1,
"campaign_price": 1
}
],
"collection_products": [
{
"product_id": 2,
"product_name": "burger",
"reward": 1
}
]
}