Skip to main content

PetsService

A list of all methods in the PetsService service. Click on the method name to view detailed information about that method.

MethodsDescription
listPets
createPets
showPetById

listPets

  • HTTP Method: GET
  • Endpoint: /pets

Parameters

NameTypeRequiredDescription
limitnumberHow many items to return at one time (max 100)

Return Type

Pet[]

Example Usage Code Snippet

import { PetstoreClient } from 'petstore_client';

(async () => {
const petstoreClient = new PetstoreClient({
token: 'YOUR_TOKEN',
});

const { data } = await petstoreClient.pets.listPets({
limit: 81,
});

console.log(data);
})();

createPets

  • HTTP Method: POST
  • Endpoint: /pets

Parameters

NameTypeRequiredDescription
bodyPetThe request body.

Example Usage Code Snippet

import { Pet, PetstoreClient } from 'petstore_client';

(async () => {
const petstoreClient = new PetstoreClient({
token: 'YOUR_TOKEN',
});

const input: Pet = {
id: 2,
name: 'name',
tag: 'tag',
};

const { data } = await petstoreClient.pets.createPets(input);

console.log(data);
})();

showPetById

  • HTTP Method: GET
  • Endpoint: /pets/{petId}

Parameters

NameTypeRequiredDescription
petIdstringThe id of the pet to retrieve

Return Type

Pet

Example Usage Code Snippet

import { PetstoreClient } from 'petstore_client';

(async () => {
const petstoreClient = new PetstoreClient({
token: 'YOUR_TOKEN',
});

const { data } = await petstoreClient.pets.showPetById('petId');

console.log(data);
})();

Build Your Own SDKs with  liblab

Build developer friendly SDKs in minutes from your APIs

Start for Free →