Skip to content

Instantly share code, notes, and snippets.

@WattyRev
Last active January 8, 2019 00:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save WattyRev/8582ceafd1a923e4b4de22b5c39f2aae to your computer and use it in GitHub Desktop.
Save WattyRev/8582ceafd1a923e4b4de22b5c39f2aae to your computer and use it in GitHub Desktop.
REST API format example

Models

Dog

{
  id: *<String>*,
  name: *<String>*,
  ownerId: *<Human>*,
  dateOfBirth: *<DateTime>*,
  breed: *<Enum>*
}

Human

{
  id: *<GUID>*,
  name: *<String>*
}

Dogs API parameters

{
  includes: <String>[],
  idList: <GUID>[],
  idNotList: <GUID>[],
  nameContains: <String>,
  dateOfBirthGTE: <DateTime>,
  dateOfBirthLTE: <DateTime>,
  breedList: <Enum>[],
  breedNotList: <Enum>[]
}

Example request:

GET /dogs/?includes=owner&nameContains=Chomp

Response

{
  dogs: [
    {
      id: "123",
      name: "Mr Chompers",
      ownerId: "098",
      dateOfBirth: datetimewhatever
    },
    {
      id: "234",
      name: "Little Chompers",
      ownerId: "098",
      dateOfBirth: datetimewhatever
    },
    {
      id: "345",
      name: "Chomp Chomp",
      ownerId: "987",
      dateOfBirth: datetimewhatever
    }
  ],
  humans: [
    {
      id: "098",
      name: Frank McDogowner
    },
    {
      id: "987",
      name: Jose McPerroowner
    }
  ]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment