This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
|
ors-soap-api:public:json_api [2017/12/13 15:35] admin |
ors-soap-api:public:json_api [2023/03/08 12:42] (current) admin |
||
|---|---|---|---|
| Line 6: | Line 6: | ||
| ===== PHP Example ===== | ===== PHP Example ===== | ||
| + | |||
| + | # JSON search region request example | ||
| <code json> | <code json> | ||
| Line 27: | Line 29: | ||
| "pass":"[password]", | "pass":"[password]", | ||
| "agid":"[agency-id]" | "agid":"[agency-id]" | ||
| + | "api-key":"[your-api-key]" | ||
| } | } | ||
| } | } | ||
| Line 32: | Line 35: | ||
| <code php> | <code php> | ||
| - | // search regions request example | + | // PHP cURL post example |
| $data_string = 'json-request-string'; | $data_string = 'json-request-string'; | ||
| Line 49: | Line 52: | ||
| </code> | </code> | ||
| + | ===== Online Tester ===== | ||
| + | |||
| + | You can also use this online tester to test your requests: | ||
| + | |||
| + | [[http://api.ors.si/test/]] | ||
| + | |||
| + | ===== Requests ===== | ||
| + | |||
| + | Each basic request consist of the following attributes: | ||
| + | |||
| + | ^ Name ^ Description ^ Example ^ | ||
| + | | requestType | a type of request | search | | ||
| + | | action | which action to take (same name as SOAP methods) | regions | | ||
| + | | search | search parameters | "epc":"2", "typ":"hotel", ...| | ||
| + | | header | [[soap_header]] | check example below | | ||
| + | |||
| + | |||
| + | |||
| + | There are 4 types of **requestType** available: | ||
| + | |||
| + | * search : for searching regions, offers and trips | ||
| + | * info : to get object descriptions and flight information, | ||
| + | * check : for availability request, | ||
| + | * book : to create registrations, booking, cancellations | ||
| + | |||
| + | So fo example if you wish to search for hotels in a selected region, you create request like so: | ||
| + | |||
| + | <code json> | ||
| + | { | ||
| + | "requestType":"search", | ||
| + | "action":"offers", | ||
| + | "search":{ | ||
| + | "typ":"hotel", | ||
| + | "vnd":"2018-01-10", | ||
| + | "bsd":"2018-03-10", | ||
| + | "tdc":"1-5", | ||
| + | "rgcs":"100023", | ||
| + | "epc":"2" | ||
| + | }, | ||
| + | "header":{ | ||
| + | "lang":"[lang-code]", | ||
| + | "usr":"[username]", | ||
| + | "pass":"[password]", | ||
| + | "agid":"[agency-id]" | ||
| + | "api-key":"[your-api-key]" | ||
| + | } | ||
| + | } | ||
| + | </code> | ||
| + | ===== Response ===== | ||
| + | |||
| + | If **error** occurs, this is an example of the output | ||
| + | |||
| + | <code json> | ||
| + | { | ||
| + | "errorNr":2001, | ||
| + | "error":{"msg":"Invalid (or missing) action"} | ||
| + | "rqid" : "request-id" | ||
| + | } | ||
| + | </code> | ||
| + | |||
| + | On **success** you will get a JSON string which is the same structure as you would get with SOAP requests. Please check [[soap_calls]] for details. | ||