In the case of our favorite original tester, Grizzly, requesting his information would take the following form:
curl -H "Authorization: Bearer abc123" GET https://pethub.io/v1/pets/223
The above authorized call to PetHub.io's "/v1/pets/{id}" endpoint with Grizzly's unique identifier (where "223" replaces the "{id}") would receive the following response:
{ "pid": "223", "uid": "66", "name": "Grizzly", "species": { "tid": "3031" }, "breed_primary": { "target_id": "2855" }, "breed_mix": "Chihuahua", "gender": "Male", "picture": { "fid": "189", "uid": "66", "filename": "grizzly.jpg", "filemime": "image/jpeg", "filesize": "7735", "status": "1", "timestamp": "1414801248", "type": "image", "metadata": { "height": 280, "width": 186 }, "height": "280", "width": "186", "url": "https://images.pethub.com/dev/pub/grizzly.jpg?milgJeq.a.UHYX6vfvnF7f2alm0p1Y5H" }, "birthday": "2013-11-16 00:00:00", "size": { "tid": "3236" }, "weight_value": "4", "weight_unit": "lb", "coat": "Short Hair", "tail": { "tid": "3428" }, "altered": { "value": "Yes" }, "description": "Our precious fuzzi-wuzzums.", "microchip": "" }
The format of the data above is JSON which is the default format typically specified in the Header as part of the request. However, if necessary, the format can be explicitly requested by appending ".json" or ".xml" to the noun to receive JSON or XML formatted data, respectively. For example:
curl -H "Authorization: Bearer abc123" GET https://pethub.io/v1/pets.json/223