API 2 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/v2/user”
Quote
quoteApi: “/api/v2/quote”
Authentication
Redkik uses OAUTH2.0
Use of almost all API endpoints requires an access token. In order to obtain an access token, you must first create an API token set in the UI for a specific Organization.
You can then use the client id and the client secret of that API token to create Access Tokens, which are used to authenticate on a transactional basis.
{
"grant_type": "client_credentials",
"client_id": "4a7554d1-9266-4506-896f-153d9aea77de",
"client_secret": "71ab421efdea1f777ec98eb9ffe7caadc239bfa659d53f1e609960beb5180856"
}
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://sales.app.redkik.com/api/v2/user/oauth/token'
Get Setup Information
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://sales.app.redkik.com/api/v1/quote/quotes/setup'
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://sales.app.redkik.com/api/v2/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://sales.app.redkik.com/api/v2/quote/bookings/purchase'