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:45] admin [Requests] |
ors-soap-api:public:json_api [2023/03/08 12:42] (current) admin |
||
---|---|---|---|
Line 7: | Line 7: | ||
===== PHP Example ===== | ===== PHP Example ===== | ||
- | <code json> | ||
# JSON search region request example | # JSON search region request example | ||
+ | |||
+ | <code json> | ||
{ | { | ||
"requestType":"search", | "requestType":"search", | ||
Line 28: | Line 29: | ||
"pass":"[password]", | "pass":"[password]", | ||
"agid":"[agency-id]" | "agid":"[agency-id]" | ||
+ | "api-key":"[your-api-key]" | ||
} | } | ||
} | } | ||
Line 49: | Line 51: | ||
echo $result; | echo $result; | ||
</code> | </code> | ||
+ | |||
+ | ===== Online Tester ===== | ||
+ | |||
+ | You can also use this online tester to test your requests: | ||
+ | |||
+ | [[http://api.ors.si/test/]] | ||
===== Requests ===== | ===== Requests ===== | ||
- | There are 4 types of ''requestType''s available: | + | 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 | * search : for searching regions, offers and trips | ||
Line 59: | Line 77: | ||
* book : to create registrations, booking, cancellations | * book : to create registrations, booking, cancellations | ||
- | Each request must also have an ''action'' which is named the same as SOAP api call methods. | + | So fo example if you wish to search for hotels in a selected region, you create request like so: |
- | + | ||
- | So fo example if you wich to search for hotels in a selected region, you create request like so: | + | |
<code json> | <code json> | ||
Line 74: | Line 90: | ||
"rgcs":"100023", | "rgcs":"100023", | ||
"epc":"2" | "epc":"2" | ||
- | }, | ||
- | "top":{ | ||
- | "toc":"FTI", | ||
- | "stc":"3" | ||
}, | }, | ||
"header":{ | "header":{ | ||
Line 84: | Line 96: | ||
"pass":"[password]", | "pass":"[password]", | ||
"agid":"[agency-id]" | "agid":"[agency-id]" | ||
+ | "api-key":"[your-api-key]" | ||
} | } | ||
} | } | ||
Line 95: | Line 108: | ||
"errorNr":2001, | "errorNr":2001, | ||
"error":{"msg":"Invalid (or missing) action"} | "error":{"msg":"Invalid (or missing) action"} | ||
+ | "rqid" : "request-id" | ||
} | } | ||
</code> | </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. | 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. |