Read a single record from a resource
To fetch a specific record from a resource we use a GET
request of the format:
GET /API/V3/<interface_path>/<key_value>
So to retrieve a specific Order
, along with its Orderline
s, you could use the following request:
GET /API/V3/Order+Orderline/ORD00521
This would retrieve the Order
for the record with an order_number
(primary key) of ORD00521
, along with all orderlines (as requested in the resource specification).
Limiting returned fields
You can limit the fields returned in a response by passing a _fields
parameter. See the fields section of the fetch documentation for more detail.
Response
The API will reponse with a status 200 OK
containing the following XML body:
<?xml version="1.0" encoding="utf-8" ?>
<ResultSet startResultIndex="0" totalResults="1" totalResultsReturned="1" xmlns="http://www.zeald.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.zeald.com https://www.clientwebsite.nz/API/V3/Order+Orderline.xsd">
<Order href="https://www.clientwebsite.nz/API/V3/Order/ORD00521" id="Model::Transactions::ORD00521">
<order_number>ORD00521</order_number>
<username>foo@bar.com</username>
<!-- etc -->
<Orderline>
<code>ORD00521-1</code>
<sku>foo-sku</sku>
<quantity>4</quantity>
<!-- etc -->
</Orderline>
</Order>
</ResultSet>
Error response
If the record does not exist, the API will return a 404 Not Found
status with the following XML body:
<?xml version="1.0" encoding="utf-8" ?>
<rsp stat="fail" version="3.0">
<error>
<code>404</code>
<msg>Order ORD00521 not found</msg>
</error>
</rsp>
See error responses for more information.