orders

Recommended version is 2016.3001

List orders

Lists one or more orders for the logged on and authenticated user.

Request

HTTP GET to /orders

Filter

 

Name

Required

Value

Description

Data type

Default

number

no

number=1254

Order number

String

 

businessunitids

no

businessunitids=4,3

Only specified business units/facilities

ID-list

 

fromdate

no

fromdate=2011-12-24

Start date

Date

One year ago

todate

no

todate=2012-12-25

End date

Date

Tomorrow

orderedbyidnoorderedbyid=6389Customer's IDID 

Example:

APIURL/orders.xml?apikey=338934897438&businessunitids=4,3

Response

Tag

Data type

Example

Description

orders

 

<orders>

The root tag that encloses all orders

order

 

<order>

Order

id

ID

<id>12</id>

Unique ID

number

Integer

<number>51</number>

Order number

created

Time stamp

<created>2011-04-26 14:45</created>

When the order was created

orderedby

 

<orderedby>

Customer

id

ID

<id>5</id>

The customers ID

number

String

<number>1345</number>

The customer's customer number

name

String

<name>John Doe</name>

The customer's full name

streetaddress

String

<streetaddress>Mainstreet 10</streetaddress>

Street address1

postaladdress

String

<postaladdress>590 23 Springfield</postaladdress>

Postal address1

country

String

<country>Sweden</country>

Country1

businessunit

 

<businessunit><id>11</id><name>Main street Center</name></businessunit>

The customers active business unit/facility

items

 

<items>

The items tag that surrounds the order rows

item

 

<item>

An order row

id

ID

<id>1402</id>

The order's ID

producttype

String

<producttype>Service</producttype>

Type of product

productname

String

<productname>Tennis 1 hour</productname>

Name of product

resources

String

<id>11</id><name>Court 1</name><type>Employee</type>

Resource

valuecard See ValuecardsValuecard information. Included if producttype of the item is of valuecard.

start

Time stamp

<start><timepoint><timestamp>1340920800</timestamp><datetime>2012-06-29 00:00</datetime><date>2012-06-29</date><time>00:00</time></timepoint></start>

The order's start time

end

Time stamp

<end><timepoint><timestamp>1340923600</timestamp><datetime>2012-06-30 00:00</datetime><date>2012-06-30</date><time>00:00</time></timepoint></end>

The order's end time

numberofproducts

Integer

<numberofproducts>1</numberofproducts>

Number of units

participantString<participant>Jane Doe</participant> 

priceexvat

Integer

<priceexvat>3600</priceexvat>

Ammount in cents/ören without VAT

priceincvat

Integer

<priceincvat>4500</priceincvat>

The ammount in cents/ören with VAT

campaignitems <campaignitems><id>1403</id>...</campaignitems>(Only available on the subscription product type) The ID for the order rows that have used the campaign feature.
useridID<userid>44</userid>(Only available on the subscription product type) The user of the subscription.

vatsums

 

<vatsums>

 

vatsum

 

<vatsum>

Shows the VAT rate and how much of the order that is paid with this rate.

rate

Integer

<rate>25</rate>

The VAT rate in percent

amount

Integer

<amount>7200</amount>

Ammount in cents/ören

sum

Integer

<sum>54000</sum>

The total sum in cents/ören

lefttopay

Integer

<lefttopay>0</lefttopay>

Remaining ammount to be paid in cents/ören, 0 if the order is paid in full.

fullydebitedBoolean<fullydebited>true</fullydebited>True if all incleded items have been debited.

mark

String

<mark>Tennis</mark>

Label. A short text string displayed on the header of the invoice.

externalnote

String

<externalnote>Thank you for your order</externalnote>

External message. A text string printed out beneath the order rows on an invoice. When the invoice is created the user may select if this is to be included or not.

internalnoteString<internalnote>Internal message here</internalnote>Internal message.
bringnotetoinvoiceBoolean<bringnotetoinvoice>true</bringnotetoinvoice>Bring external note to invoice.

preliminary

Boolean

<preliminary>true</preliminary>

Preliminary

preliminaryuntilTime stamp<preliminaryuntil>2011-04-26 14:55</preliminaryuntil>Preliminary until. If not payed for (or set to preliminary=false) the order will be removed after this timepoint. Preliminary until will be updated when items are added to the order.

seller

 

<seller><id>5</id><name>John Doe</name></seller>

Name and id of the person who made the sale. (By default this is the same as orderedby. If sellerid is not specified at order creation)

coupons <coupons> 
coupon <coupon>Discount coupon
nameString<name>DISCOUNTCODE</name>Discount code
coupondiscountinteger<coupondiscount>68400</coupondiscount>The amount of discount received from coupons on this order, in cents/ören.

1 The customers address if it is complete, otherwise the customers invoice address will be used. A final option is the customer's organisation address and/or invoice address. An address is considered complete if it contains a street, zip code and city.

 

<orders>
  <order>
    <id>65</id>
    <number>51</number>
    <created>2011-04-26 14:45</created>
    <orderedby>
      <id>5</id>
      <number>1345</number>
      <name>John Doe</name>
      <streetaddress>Main Street 10</streetaddress>
      <postaladdress>590 23 Springfield</postaladdress>
      <country>Sweden</country>
    </orderedby>
    <businessunit>
      <id>11</id>
      <name>Main Street Center</name>
    </businessunit>
    <items>
      <item>
        <id>1402</id>
        <producttype>Service</producttype>
        <productname>Tennis 1 hour</productname>
        <productid>18</productid>
		<resources>
			<resource>
				<id>11</id>
      			<name>Wilander</name>
      			<type>Room</type>
        	</resource>
        </resources>
        <start>
          <timepoint>
            <timestamp>1340920800</timestamp>
            <datetime>2012-06-29 00:00</datetime>
            <date>2012-06-29</date>
            <time>00:00</time>
          </timepoint>
        </start>
        <end>
          <timepoint>
            <timestamp>1340923600</timestamp>
            <datetime>2012-06-30 00:00</datetime>
            <date>2012-06-30</date>
            <time>00:00</time>
          </timepoint>
        </end>
        <numberofproducts>1</numberofproducts>
	    <participant>Jane Doe</participant>
        <priceexvat>3600</priceexvat>
        <priceincvat>4500</priceincvat>
      </item>
      <item>
      ...
      </item>
    </items>
    <sumexvat>45781</sumexvat>
    <vatsums>
      <vatsum>
        <rate>25</rate>
        <amount>7200</amount>
      </vatsum>
      <vatsum>
        <rate>6</rate>
        <amount>1019</amount>
      </vatsum>
    </vatsums>
    <sum>54000</sum>
    <lefttopay>0</lefttopay>
	<coupondiscount>0</coupondiscount>
    <mark>Tennis</mark>
    <externalnote>Thank you for your order</externalnote>
	<internalnote>Internal message here</internalnote>
	<bringnotetoinvoice>true</bringnotetoinvoice>
    <preliminary>true</preliminary>
    <preliminaryuntil>2011-04-26 14:55</preliminaryuntil>
	<seller>
		<id>5</id>
        <name>John Doe</name>
	</seller>
	<coupons>
		<coupon>
			<name>DISCOUNTCOUPON</name>
		</coupon>
	</coupons>
  </order>
</orders>

Create order

Create an order that can be filled with order rows and paid. Requires basic HTTP-authentication

Request

Name

Required

Value

Date type

Description

currentbusinessunitid

no

currentbusinessunitid=331

ID

To create an order on a different business unit/facility than current one specify this.
selleridno IDId of the person who made the sale. Same as orderdby if not specified.
externalnoteno StringExternal note on order.
internalnoteno StringInternal note on order.
bringnotetoinvoiceno BooleanBring external note to invoice.
couponsnocoupons=EXAMPLECODE,ANOTHEREXAMPLEStringComma separated list of discount codes. If any of the codes are not found, the request will result in status 400 and error code 1107

 

Example:

POST:APIURL/orders.xml
apikey=338934897438

Response

Same as listing of an order

Change order

Change the values of an order. Requires basic HTTP-authentication

Request

Order values that may be changed

 

Name

Value

Description

Date type

preliminary

preliminary=false

A preliminary order is automatically deleted

Boolean

markmark=Jag%20%26%20Mia%20kommer%20sentA URL encoded note

Sträng 

externalnoteexternalnote=Gl%C3%B6m%20inte%20handdukA URL encoded external noteSträng
internalnoteinternalnote=internal%20messageA URL encoded internal noteString
bringnotetoinvoicebringnotetoinvoice=trueBring external note to invoiceBoolean
couponscoupons=EXAMPLECODE,ANOTHEREXAMPLE

Comma separated list of discount codes to replace any current discount codes. If any of the codes are not found, the request will result in status 400 and error code 1107.
An empty string removes all coupons from the order.

String

Example:

PUT:APIURL/orders/{id}.xml?apikey=338934897438&preliminary=false

Request

Same as for listing of an order

Delete

Deletes the order and it's contents. Each order row must be booked on the internet, be undebited and fullfill the cancellation rules in order for the entire order to be deleted.

If the order is anonymous include the parameter anonymous=true

Request

Example:

DELETE:APIURL/orders/\{id\}.xml?apikey=338934897438

Response

HTTP 204
No content.

Servicebooking with entry rights.

/wiki/spaces/INST/pages/2343010442 A special case where an order with service bookings is used to let users through a gate based on a QR-code.