example-data.com
Menu
Browse docs and collections

pets

pets

Page 7 of 9.

Overview

Request

curl example

curl -sS \
  "https://example-data.com/api/v1/pets?limit=25"

JavaScript example

const res = await fetch(
  "https://example-data.com/api/v1/pets?limit=25"
);
const { data, meta } = await res.json();

TypeScript example

// Download once: mkdir -p types && curl -o types/pets.d.ts https://example-data.com/types/pets.d.ts
import type { Pet, ListEnvelope } from "./types/pets";

const res = await fetch(
  "https://example-data.com/api/v1/pets?limit=25"
);
const { data, meta } = (await res.json()) as ListEnvelope<Pet>;

Python example

import requests

res = requests.get(
    "https://example-data.com/api/v1/pets",
    params={"limit": 25},
)
data = res.json()

Response

{
  "data": [
    {
      "id": 145,
      "ownerUserId": 154,
      "name": "Milo",
      "species": "dog",
      "breedId": 12,
      "gender": "female",
      "birthDate": "2019-06-16",
      "weightKg": 42.1,
      "color": "Black",
      "imageUrl": "https://picsum.photos/seed/pet-145/600/600",
      "createdAt": "2017-10-13T00:14:36.294Z",
      "updatedAt": "2019-12-04T08:22:19.703Z"
    },
    {
      "id": 146,
      "ownerUserId": 155,
      "name": "Herta",
      "species": "cat",
      "breedId": 41,
      "gender": "female",
      "birthDate": "2012-04-14",
      "weightKg": 2.4,
      "color": "Tuxedo",
      "imageUrl": "https://picsum.photos/seed/pet-146/600/600",
      "createdAt": "2016-03-02T07:51:26.216Z",
      "updatedAt": "2019-04-08T07:24:13.897Z"
    },
    {
      "id": 147,
      "ownerUserId": 156,
      "name": "Morton",
      "species": "dog",
      "breedId": 10,
      "gender": "male",
      "birthDate": "2022-07-13",
      "weightKg": 9.9,
      "color": "Brown",
      "imageUrl": "https://picsum.photos/seed/pet-147/600/600",
      "createdAt": "2016-08-26T18:05:43.735Z",
      "updatedAt": "2018-03-11T15:35:46.285Z"
    }
  ],
  "meta": {
    "page": 7,
    "limit": 24,
    "total": 200,
    "totalPages": 9
  },
  "links": {
    "self": "/api/v1/pets?page=7&limit=24",
    "first": "/api/v1/pets?page=1&limit=24",
    "last": "/api/v1/pets?page=9&limit=24",
    "next": "/api/v1/pets?page=8&limit=24",
    "prev": "/api/v1/pets?page=6&limit=24"
  }
}