API Usage & Authentication
API Usage
Like most RESTful APIs these days, the platform publishes resources using HTTP verb semantics to allow data to be passed in and out of the system.
User
userApi: “/api/v1/user”
Quote
quoteApi: “/api/v1/quote”
- Log in and gain an accessToken
- Submit Commodity, Journey, and Booking Holder information
- /api/v1/quote/Booking/quote
- Submit the returned offer ID to the purchase endpoint
- /api/v1/quote/Booking/purchase
Authentication
Use of almost all API endpoints requires an access token. In order to obtain an access token, access the /User/login endpoint using a valid email and password in the JSON body, e.g.:
{
“email”:”user@example.com”,
“password”:”Password”
}
Code Examples
Basic Authentication
curl -X POST \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
-d '{
"email":"ademo.user@redkik.com",
"password":"4k8pYePrBpj-23K"
Confidential
}' \
'https://demo.broker.redkik.com/api/v1/user/Users/login' | jq -r
.id
Generate an Offer
curl -X POST --header 'Content-Type: application/x-www-form-urlencoded'
--header 'Accept: application/json' -d 'journeyLegs=[ {
"startTime": "2023-04-29T21:00:00.000Z",
"endTime": "2023-04-30T21:00:00.000Z",
"start": "Joensuu, Finland",
"end": "Helsinki, Finland",
"transportTypes": ["1"],
"transportFeatures": []
} ]
commodityId=105
insuredValue=100000
bookingHolder={
"email": "example.user@email.com",
"addressStreet": "Lansikatu 15",
"addressLocality": "Joensuu",
"addressState": "Pohjois-karjala",
"addressPostcode": "80100",
"addressCountry": "a0fbbabe-26cd-47e5-b9ad-88b72f06ac45",
"businessName": "Redkik Inc"
} ' 'https://demo.broker.redkik.com/api/v1/quote/Bookings/quote'
Purchase Booking
curl -X POST --header 'Content-Type: application/x-www-formurlencoded' --header 'Accept: application/json' -d
'offerId=565e807b-5a8c-425c-ae93-e6999f6339e9'
'https://demo.broker.redkik.com/api/v1/quote/Bookings/purchase'