Readonly
rootDefinition shape of an API or a path of an API
Builds a new PAPICaller based on the current shape of the internal definition
Optional
config: PAPIConfigDefine the response when sending a DELETE request to an endpoint
Shape of the API's response
Shape of the API's response
papi('https://jsonplaceholder.typicode.com')
.path('user', user => user.delete({}));
Define the response when sending a DELETE request to an endpoint, as well as provide information about alternate ways to request the API and/or alternate ways the API can respond
Shape of the API's response
Builder function that further defines specific behaviors of requesting this endpoint
papi('https://jsonplaceholder.typicode.com')
.path('user', user => user.delete({}, $delete => $delete...));
Define the response when sending a GET request to an endpoint
Shape of the API's response
Shape of the API's response
papi('https://jsonplaceholder.typicode.com')
.path('user', user => user.get({}));
Define the response when sending a GET request to an endpoint, as well as provide information about alternate ways to request the API and/or alternate ways the API can respond
Shape of the API's response
Builder function that further defines specific behaviors of requesting this endpoint
papi('https://jsonplaceholder.typicode.com')
.path('user', user => user.get({}, $get => $get...));
Define the response when sending a PATCH request to an endpoint
Shape of the API's response
Shape of the API's response
papi('https://jsonplaceholder.typicode.com')
.path('user', user => user.patch({}));
Define the response when sending a Patch request to an endpoint, as well as provide information about alternate ways to request the API and/or alternate ways the API can respond
Shape of the API's response
Builder function that further defines specific behaviors of requesting this endpoint
papi('https://jsonplaceholder.typicode.com')
.path('user', user => user.patch({}, $patch => $patch...));
Define a new path segment of an API. A path segment is each section of an API's endpoint URL separated by a /
that
has a fixed value -- for instance, in the fake API https://fake.api/v2/user/:userId
, the values of v2
and user
are path segments
A path segment's definition may contain other paths/shareds/slugs as well as endpoint definitions.
Path segment of the url
Builder function that further defines the shape of the path
papi('https://jsonplaceholder.typicode.com')
.path('user', user => user...);
Define the response when sending a POST request to an endpoint
Shape of the API's response
Shape of the API's response
papi('https://jsonplaceholder.typicode.com')
.path('user', user => user.post({}));
Define the response when sending a POST request to an endpoint, as well as provide information about alternate ways to request the API and/or alternate ways the API can respond
Shape of the API's response
Builder function that further defines specific behaviors of requesting this endpoint
papi('https://jsonplaceholder.typicode.com')
.path('user', user => user.post({}, $post => $post...));
Define the response when sending a PUT request to an endpoint
Shape of the API's response
Shape of the API's response
papi('https://jsonplaceholder.typicode.com')
.path('user', user => user.put({}));
Define the response when sending a PUT request to an endpoint, as well as provide information about alternate ways to request the API and/or alternate ways the API can respond
Shape of the API's response
Builder function that further defines specific behaviors of requesting this endpoint
papi('https://jsonplaceholder.typicode.com')
.path('user', user => user.put({}, $put => $put...));
Define a new shared segment of an API. A shared segment is each section of an API's endpoint URL separated by a /
that
can represent multiple values from a selected set -- for instance, in the fake API https://fake.api/v2/categories/:category
,
where only the values "comments", "photos", and "users" are valid, the value of :category
is a shared segment
A shared segment's definition may contain other paths/shareds/slugs as well as endpoint definitions.
Builder function that further defines the shape of the shared segment
papi('https://jsonplaceholder.typicode.com')
.shared(userId => userId...);
Define a new slug segment of an API. A slug segment is each section of an API's endpoint URL separated by a /
that
can represent multiple values -- for instance, in the fake API https://fake.api/v2/user/:userId
, the value of :userId
is a slug segment
A slug segment's definition may contain other paths/shareds/slugs as well as endpoint definitions.
Builder function that further defines the shape of the slug
Builder function that further defines the shape of the slug
papi('https://jsonplaceholder.typicode.com')
.slug(userId => userId...);
Builder interface to define an API