octorate api integration code example

Example 1: octorate api integration

some reference links that might help :
https://api.octorate.com/connect/start.html
https://partner.octorate.com/integration/start.html
https://api.octorate.com/connect/index.html
https://api.octorate.com/connect/docs/#/Property/retrieveAccommodations (important)
https://community.octorate.com/post/you-wish-to-create-a-derived-rate-5f8ea06d5070927b86906211
https://api.octorate.com/connect/redocly.html#operation/createSingleReservation
https://api.octorate.com/connect/showcases/create_ota.html
https://api.octorate.com/connect/showcases/create_ota.html

IMPORT TO POSTMAN FOR ALL OCTORATE API's:
https://api.octorate.com/connect/rest/v1/integration/openapi.yaml

api urls
https://api.octorate.com/connect/docs/
https://api.octorate.com/connect/rest/v1/identity/token

( NOTE* : POST Method shoud pass header as 
Content-Type: application/x-www-form-urlencoded 
AND BODY inside
x-www-form-urlencoded )

STEP 1: For getting code
GET METHOD:
https://admin.octorate.com/octobook/identity/oauth.xhtml?client_id=PUBLIC_KEY&redirect_uri=https%3A%2F%2Flocalhost%2F

STEP 2: For verifying code and getting access token
POST METHOD:
https://api.octorate.com/connect/rest/v1/identity/token
	PARAMS:
    client_secret: CLIENT_SECRET_KEY (IN CONFIG MAIL)
    client_id: CLIENT_ID (IN CONFIG MAIL)
    redirect_uri: https://localhost/ (SAME AS INSIDE STEP 1)
    grant_type: code
    code: CODE_FROM_STEP1_RESPONSE
    
STEP 3: For refreshing access_token
POST METHOD:
https://api.octorate.com/connect/rest/v1/identity/refresh
	PARAMS:
    client_secret: CLIENT_SECRET_KEY (IN CONFIG MAIL)
    client_id: CLIENT_ID (IN CONFIG MAIL)
    refresh_token: REFRESH_TOKEN (FROM STEP 2)

Example 2: process for octorate api integration

There are basically two types of login for access property( Rooms )
1. Site login (https://admin.octorate.com/octobook/identity/oauth.xhtml?client_id=PUBLIC_KEY&redirect_uri=https%3A%2F%2Flocalhost%2F)
	a) it will provide you the code and then from that code you need to get the
    	access_token.

2. Api Login (https://api.octorate.com/octobook/rest/identity/apilogin)
	a) Directly provides you a access_token.
    
Three steps to work with (API Login):
1. Authorization (https://api.octorate.com/connect/rest/v1/identity/apilogin)
	Method => POST
	Header => Content-Type:application/x-www-form-urlencoded
    Params => client_secret:CLIENT_SECRET
			  client_id:CLIENT_ID
2. Get accommodations (https://api.octorate.com/connect/rest/v1/accommodation)
	Method => GET
	Header => Content-Type:application/json
			  Authorization:Bearer ACCESS_TOKEN

Tags:

Misc Example