Book users onto course date

Book one or more users onto a course date.

Use this API call to create a new order. The response body will contain a summary with the id of the newly created order.

Request

POST https://www.kursguiden.no/api/v2/booking

For every API request you make, you'll need to present the API access key in the HTTP Header as X-API-Key to be authenticated.

Parameters

Name Required Value Description
coursedate_id required number Course date identifier. i.e. 12792066
payment_method required string Currently only 'invoice' is supported
currency optional string Three-letter ISO currency code, in lowercase. Must be a supported currency.
Exchange rate must exist for the selected currency ISO code. Defaults to selected standard currency.

Supported currencies:
  • aed = Emirati dirham
  • all = Albanian lek
  • aud = Australian dollars
  • brl = Brazilian real
  • byr = Belarussian ruble
  • cad = Canadian dollar
  • chf = Swiss franc
  • cny = Chinese yuan
  • czk = Czech koruna
  • dkk = Danish kroner
  • eur = Euro
  • gbp = British pounds
  • huf = Hungarian forints
  • idr = Indonesian Rupiah
  • ils = Israeli shekel
  • inr = Indian rupee
  • isk = Icelandic krona
  • jpy = Japanese yen
  • ltl = Lithuanian litas
  • mxn = Mexican peso
  • nok = Norwegian kroner
  • pln = Polish zloty
  • ron = Romanian leu
  • rsd = Serbian dinar
  • rub = Russian rubles
  • sar = Saudi Arabian Riyal
  • sek = Swedish kroner
  • sgd = Singapore dollar
  • usd = US dollar
campaign_code optional string Campaign code if any
voucher_code optional string Voucher code if any
booker_name optional string Booker name
booker_email optional string Booker email
booker_phone optional string Booker phone number
company optional string Company name
company_number optional string Orgnr.
gln_number optional string GLN Number
invoice_reference optional string Invoice reference
invoice_address_1 optional string Invoice address line 1
invoice_address_2 optional string Invoice address line 2
invoice_address_3 optional string Invoice address line 3
invoice_zipcode optional string Invoice zipcode
invoice_city optional string Invoice city
invoice_email optional string Invoice email
invoice_firstname optional string Invoice firstname
invoice_lastname optional string Invoice lastname
invoice_phone optional string Invoice phone
participants required array
Name Required Value Description
firstname required string Participant firstname
lastname required string Participant lastname
price optional
The price of the course product
string We will try to determine the price for the main course product in the following order:
  1. Participant
  2. Product passed in
  3. Price from the product
This means that you can either pass the price on the participant itself, by providing a custom product (requires "auto_append_course_product" to be false), or let it default to the price stored in the system.

email required string Participant email
phone optional string Participant phone number
company optional string Participant company
company_number optional string Participant company number
position optional string Participants job title
date_of_birth optional string YYYY-MM-DD
country optional string Participant country
comment optional string Comment
national_identification_number optional string Participant national identification number
status_id optional string Status id for the attender
  • 1 = Confirmed
  • 2 = Overbooked
  • 3 = Waiting list
  • 7 = Unconfirmed
home_address optional object
Name Required Value Description
address_line_1 optional string Address line 1
address_line_2 optional string Address line 2
address_line_3 optional string Address line 3
zipcode optional string Zipcode
city optional string City
work_address optional object
Name Required Value Description
address_line_1 optional string Address line 1
address_line_2 optional string Address line 2
address_line_3 optional string Address line 3
zipcode optional string Zipcode
city optional string City
products required

Required if configuration 'auto_append_course_product' is set to false
array
Name Required Value Description
id required integer The product id. This is the only property that is truly required.
price optional float If price is not set the price from the product will be used.
discount_percent optional float Discount as percent. Discount as percent has precedence and will be used if set.
discount_amount optional float Discount as amount. If discount as percent is used this will be disregarded.
custom_properties optional

Use custom properties to set meta data on each participant. Use key names up to 40 characters long. Value must be string up to 255 characters.
object
Name Required Value Description
my_custom_property_1 optional string Any value as long as its max 255 characters
my_custom_property_2 optional string Any value as long as its max 255 characters
config optional object
Name Required Value Description
seats_availability_check optional boolean Set this value to true to enforce seat availability check. This will throw an error if there are no vacant seats. Default: false
auto_append_course_product optional boolean If this property is set to true the main product and price from the course will be automatically added to each participant. Default: true
allow_customer_autoconnect optional boolean If this property is set to true and a company name and/or company number is set, the system will try to automatically connect to an existing customer in FrontCore. Default: true
allow_user_autoconnect optional boolean If this property is set to true and a user with the same name and email is found, the system will try to automatically connect existing to an existing user in FrontCore. Default: true
send_account_created_email_to_user optional boolean If this property is set to true a welcome email with username and password will be sent to the user. Default: true
send_receipt_email_to_participant optional boolean If this property is set to true an email receipt will be sent to the user. Default: true

Response

If the method is successful it responds with an JSON structure, as it is shown below.

{
    "successful": true,
    "summary": {
        "order_id": "221530",
        "booking_id": "472721",
        "coursedate_id": "12792066",
        "currency": "nok",
        "total_before_discounts": 1250,
        "total_calculated_discounts": 0,
        "total_excl_vat": 1250,
        "total_incl_vat": 1375,
        "total_vat": 125,
        "number_of_participants": 1,
        "payment_redirect_url" : null
    }
}

Unsuccessful response sample:

{
    "successful": false,
    "errors": [
       {
        "code" => some_error_code,
        "message" => "A human readable error response"
       }
    ]
}      



Examples


Example

{
    "coursedate_id": "12761394",
    "payment_method": "invoice",
    "currency": "usd",
    "booker_name": "Jane Doe",
    "booker_email": "jane@example.com",
    "booker_phone": "12345678",
    "company": "Example Company Inc",
    "company_number": 123456789,
    "invoice_reference": "Ref 1234",
    "invoice_address_1": "125 Holburn Lane",
    "invoice_address_2": "",
    "invoice_address_3": "",
    "invoice_zipcode": "0262",
    "invoice_city": "Heckfordbridge",
    "invoice_email": "invoice@example.com",
    "invoice_firstname": "Jane",
    "invoice_lastname": "Doe",
    "invoice_phone": "12398765",
    "participants": [
        {
            "firstname": "John",
            "lastname": "Doe",
            "date_of_birth" : "1979-12-01",
            "email": "john@example.com",
            "phone": "987654321",
            "price" : 5999,
            "status_id": 1,
            "products": [
                {
                    "id": 25883,
                    "title": "Exam", // Added for clarity. Documentation only.
                    "price": 100,
                    "discount_percent": 50
                }
            ],
            "home_address": {
                "address_line_1": "125 Holburn Lane",
                "address_line_2": "",
                "address_line_3": "",
                "zipcode": "0262",
                "city": "Heckfordbridge"
            },
            "work_address": {
                "address_line_1": "125 Holburn Lane",
                "address_line_2": "",
                "address_line_3": "",
                "zipcode": "0262",
                "city": "Heckfordbridge"
            }
        }
    ],
    "config": {
        "auto_append_course_product" : true,
        "allow_customer_autoconnect" : true,
        "allow_user_autoconnect" : true,
        "send_account_created_email_to_user" : true,
        "send_receipt_email_to_participant" : true
    }
}

Minimal example

{
    "payment_method": "invoice",
    "coursedate_id": "12761394",
    "participants": [
        {
            "firstname": "John",
            "lastname": "Doe",
            "email": "john@example.com",
            "price" : 1250 // This will override the price from the automatically appended main course product.
        }
    ],
    "config": {
        "auto_append_course_product" : true
    }
}



Error codes

school_account_invalid The school account provided through the api token is not valid. Check that your requests are specifying a valid account token.
course_identifier_invalid Course identifier is missing or invalid. Check that your requests are specifying a valid course date ID.
course_date_identifier_invalid Course date identifier is missing or invalid.. Check that your requests are specifying a valid course date ID.
default_course_product_missing The course price is missing. The course is not correctly configured.
currency_missing Currency is either missing or not supported.
exchange_rate_does_not_exist Occurs when a currency has been specified which does not have a exchange rate in the settings section
participant_name_invalid_empty Participant {index} must have a name specified. Make sure requests include all required parameters.
participant_email_invalid_empty Participant {index} must have an email address. Make sure requests include all required parameters.
participant_products_empty Participant {index} must have a product. No course product found. Make sure that all participants have at least a course product.
participant_products_invalid One of the products for participant {index} have an invalid id: {product_id}. Make sure that product ID exists on the platform.
participant_does_not_have_a_course_product Participant {index} is missing the course product.
participant_have_multiple_course_products Participant {index} is multiple course products. Only 1 course product pr. participant.
participant_product_price_invalid Participant must have a price. Check that you have a price set for all participants.
participant_count_invalid No participants found. At least one participant must be added to complete the booking.
internal_course_order_not_resolvable Could not resolve order for this course.
internal_course_orderline_not_resolvable Could not resolve the main orderline for this course.
booking_could_not_be_created Booking could not be created.
order_could_not_be_created Order could not be created.
campaign_code_invalid The campaign code provided is not valid.
campaign_code_expired The campaign code has expired.
voucher_code_invalid The voucher code provided is not valid.
voucher_code_expired The voucher code has expired
© 2024 FrontCore