A simple IRIS client for conneting and consuming RESTful OData API services.
Includes a number of example tests for implementing the OData TripPinWS service at www.odata.org
IRIS includes a robust HTTP client for requesting and processing HTTP services.
OData is a specification for building consistent RESTful API services. With a small amount of boiler plate code it is possible to extend the IRIS HTTP client with a number of helpful methods.
The full project code and tests are provided in this Git repository. To install the code, import the DcLib_OData1.0.xml file found in the build folder.
https://community.intersystems.com/post/creating-odata-api-adapter-intersystems-iris
DC>d ##class(TripPinWS.Tests).TestGenericFetchAllUsingWithPeople()
Russell Whyte
Scott Ketchum
Ronald Mundy
Javier Alfred
Willie Ashmore
Vincent Calabrese
Clyde Guess
Keith Pinckney
Marshall Garay
Ryan Theriault
Elaine Stewart
Sallie Sampson
Joni Rosales
Georgina Barlow
Angel Huffman
Laurel Osborn
Sandy Osborn
Ursula Bright
Genevieve Reeves
Krista Kemp
DC>d ##class(TripPinWS.Tests).TestFetchAllPeople()
Russell Whyte
Scott Ketchum
Ronald Mundy
Javier Alfred
Willie Ashmore
Vincent Calabrese
Clyde Guess
Keith Pinckney
Marshall Garay
Ryan Theriault
Elaine Stewart
Sallie Sampson
Joni Rosales
Georgina Barlow
Angel Huffman
Laurel Osborn
Sandy Osborn
Ursula Bright
Genevieve Reeves
Krista Kemp
DC>d ##class(TripPinWS.Tests).TestFetchPersonWithID()
{
"@odata.context":"http://services.odata.org/V4/(S(jndgbgy2tbu1vjtzyoei2w3e))/TripPinServiceRW/$metadata#People/$entity",
"@odata.id":"http://services.odata.org/V4/(S(jndgbgy2tbu1vjtzyoei2w3e))/TripPinServiceRW/People('russellwhyte')",
"@odata.etag":"W/\"08D73618931971BD\"",
"@odata.editLink":"http://services.odata.org/V4/(S(jndgbgy2tbu1vjtzyoei2w3e))/TripPinServiceRW/People('russellwhyte')",
"UserName":"russellwhyte",
"FirstName":"Russell",
"LastName":"Whyte",
"Emails":[
"[email protected]",
"[email protected]"
],
"AddressInfo":[
{
"Address":"187 Suffolk Ln.",
"City":{
"CountryRegion":"United States",
"Name":"Boise",
"Region":"ID"
}
}
],
"Gender":"Male",
"Concurrency":637037351471247805
}
DC>d ##class(TripPinWS.Tests).TestFetchAllAirlines()
AA American Airlines
FM Shanghai Airline
MU China Eastern Airlines
AF Air France
AZ Alitalia
AC Air Canada
OS Austrian Airlines
TK Turkish Airlines
JL Japan Airlines
SQ Singapore Airlines
KE Korean Air
CZ China Southern
AK AirAsia
HX Hong Kong Airlines
EK Emirates
DC>d ##class(TripPinWS.Tests).TestFetchAllAirports()
SFO San Francisco International Airport
LAX Los Angeles International Airport
SHA Shanghai Hongqiao International Airport
PEK Beijing Capital International Airport
JFK John F. Kennedy International Airport
CIA Rome Ciampino Airport
YYZ Toronto Pearson International Airport
SYD Sydney Airport
IST Istanbul Ataturk Airport
SIN Singapore Changi Airport
AUH Abu Dhabi International Airport
CAN Guangzhou Baiyun International Airport
ORD O'Hare International Airport
ATL Hartsfield-Jackson Atlanta International Airport
SEA Seattle-Tacoma International Airport
DC>d ##class(TripPinWS.Tests).TestForError1()
Resource not found for the segment 'Peoples'.
DC>d ##class(TripPinWS.Tests).TestForError2()
Entity ID must be provided
DC>d ##class(TripPinWS.Tests).TestFetchAllPeopleWithFilter()
Ronald Mundy
DC>d ##class(TripPinWS.Tests).TestFetchAllPeopleWithSelect()
russellwhyte
[email protected]
[email protected]
scottketchum
[email protected]
ronaldmundy
[email protected]
[email protected]
javieralfred
[email protected]
[email protected]
willieashmore
[email protected]
[email protected]
vincentcalabrese
[email protected]
[email protected]
clydeguess
[email protected]
keithpinckney
[email protected]
[email protected]
marshallgaray
[email protected]
[email protected]
ryantheriault
[email protected]
[email protected]
elainestewart
[email protected]
[email protected]
salliesampson
[email protected]
[email protected]
jonirosales
[email protected]
[email protected]
georginabarlow
[email protected]
[email protected]
angelhuffman
[email protected]
laurelosborn
[email protected]
[email protected]
sandyosborn
[email protected]
[email protected]
ursulabright
[email protected]
[email protected]
genevievereeves
[email protected]
[email protected]
kristakemp
[email protected]
DC>d ##class(TripPinWS.Tests).TestFetchAllAirportsWithSearch()
IataCode: KJFK
Name: John F. Kennedy International Airport
Address: Jamaica, New York, NY 11430
New York City
United States
Coords -73.7788888888889
40.6397222222222
DC>d ##class(TripPinWS.Tests).TestFetchAllAirportsWithAndWithoutOrderBy()
Unordered...
KSFO
KLAX
ZSSS
ZBAA
KJFK
LIRA
CYYZ
YSSY
LTBA
WSSS
OMAA
ZGGG
KORD
KATL
KSEA
Ordered...
CYYZ
KATL
KJFK
KLAX
KORD
KSEA
KSFO
LIRA
LTBA
OMAA
WSSS
YSSY
ZBAA
ZGGG
ZSSS
DC>d ##class(TripPinWS.Tests).TestFetchAirportCount()
Count of airports = 15