...
See detailed descriptions of methods here: httphttps://demoadmin.softwaresoftwaretravel.travelnet/gptp//stat/swagger/index.html#html
Access to back-office:
Code Block |
---|
demo.software.travel/gptphttps://admin.softwaretravel.net/ company alias: common login: demo1 (demo2, demo3, demo4) password: demo |
...
Code Block |
---|
B2C through API: Hfzi07ynN1uwWRBV2uU8x7fIoDn0IktQI0Xk1ExmkNk= B2B (tour operator of 1st level): oPBAyTz0Xj9j5yruUj5h0k4wiFkdKab4VA4l6zuYM0lqNs4zSySIUbPDgowX B2B (tour agency): tZE2IwvX0bMW0UPtke9tM590tgwb3P |
...
Code Block |
---|
GET /companies HTTP/1.1 Content-Type: application/json Host: demoadmin.software.travel/gptour/api |
...
The header of each request should contain the following parameters.
Parameter | Description | Example |
---|---|---|
ContentType | Always “application/json”. | “application/json” |
Token | The unique token that is generated upon authorization and identifies exact user. Is used in order to verify user permissions and provide only visible information via API (e.g. if there's a B2C user - the system will show for him only his own reservations, while if it is request from accounting system - all available reservations will be returned). | 261ec62d-86e5-4861-a6fe-0c4efbb69e85 |
Accept-Language | Is used to set preferred language in some responses. For example in location names. | Accept-Language: ru, en-gb;q=0.8, en;q=0.7 |
Methods
To compose a request you have to use HTTPS POST, GET or PUT methods for corresponding actions as presented in the following table.
Method | Description | Example |
---|---|---|
GET | Get elements or detailed information about certain element. All parameters are included in url | GET /companies |
POST | Create new element. Element data should be sent as POST body in JSON format. | POST /companies |
PUT | Update existing element. Element data sent as PUT body in JSON format. Only modified information should be sent. | PUT /companies/1000231 |
URL
The general form of the URL for all interfaces is a follows: <application>/api/<method>?<parameters> (some methods can use nesting, e.g. <application>/api/<method>/<submethod>?<parameters> or <application>/api/<method>/<id>?<parameters>, so pay attention to documentation)
Parameter | Description | Example |
---|---|---|
application[string] | The URL of your application. |
admin.software.travel/gptour | ||
method[string] | The desired REST API method to call. | companies |
id | Object id to get or update information about certain object. | 12345 |
locale | Preferred location. If it is, then Accept-Language is ignored. | locale=ru |
URL. Example | |
---|---|
|
|
Security
It is important to keep information secure. For this purpose all interaction with external applications should:
...
How to obtain API-KEY (for B2C)
Ensure that you have API module switched on (contact your account manager for that).
Log into GP Travel Enterprise back-office system.
Go to menu My Company -> B2C Settings -> open the required B2C - > General Settings -> Generated Client API key:
How to obtain API-KEY (for B2B)
Ensure that you have API module switched on (contact your account manager for that).
Log into GP Travel Enterprise back-office system.
Go to menu My Company -> Settings -> API
How to obtain token
Сall Authorization, where provide your api-key, login and password.
Take token from response.
Basic Concepts
Bi-directional interaction
...
Throughout the document for each method it is specified in what mode this method can operate as per table below.
Direction | Explanation | Example |
---|---|---|
IN | Request to GP Travel Enterprise API to get information or initiate some action. | Search Accommodation |
OUT | Availability of backward integration for push actions (will be supported only if you provide corresponding API from you side!) | Generate Invoice |
For some methods both ways are applicable.
...
Current API supports all these operations using the same method (e.g. "companies"). The difference is just how you request it. Note the following guidelines for this.
Action | How to implement | Example |
---|---|---|
Get list of objects | Use GET method. This will return information about requested objects. | GET /companies |
Get information about certain object | Use GET method with object id. | GET /companies?id=12345 |
Create new object | Use POST method. Transfer all information about this object in parameters. | POST /companies { "externalCompanyId":"12345", "companyName":"IBM", "companyType":"Corporate client" } |
Update some object | Use PUT method. Transfer all information about this object in parameters | PUT /companies { "externalCompanyId":"12345", "companyName":"IBM", "companyType":"Corporate client" } |
Deactivate some object (note: deletion is not allowed!) | Use PUT method. Transfer all information about this object in parameters and status active=false | PUT /companies { "externalCompanyId":"12345", "companyName":"IBM", "companyType":"Corporate client", "active"=false } |
Export of information via API
...
To configure API settings for export:
Ensure that you have API module switched on (contact your account manager for that).
Log into GP Travel Enterprise back-office system.
Go to menu My Company -> Settings -> API.
Check option "Export data to external applications" for setting of export API.
Set name and URL for your external application.
Configure settings.
NB: It is important that your application as receiver of exported information should be enable to get all the data in used format!
Available API settings for export
Methods | Format | Protocol |
---|---|---|
|
|
|
Export of objects according to chosen methods to external application is available on any actions (creation/updating) via API or interface of B2B. There are 2 variants of using export via API:
...
Any request contains HTTP response code that defines whether request was successful or not. In case any error occurs the system will also return the standard error code and correponding error message. Along with each error in brackets {} the set of entities and parameters can be returned to specify where exactly this error happened.
HTTP Response Codes
Error code | Description | Example |
---|---|---|
200 (OK) | Request is performed successfully. | |
400 (Bad request) | Request is incorrect | URL is wrong, missing required parameters etc. |
401 (Unauthorized) | Client is not authorized (does not have sufficient permission to perform this request). | Trying to request an action that is prohibited for the defined user. Or when the token is not submitted. |
500 (Error) | Some internal error has occurred. Error token is returned, specify it when contacting support. |