Node.js API Client
The API client is a Node.js package to interface with Foo's REST API programmatically. This package is hosted on NPM and exports an API client class with methods for interacting with endpoints. The project is typed (for those working with TypeScript). Before proceeding you may want to first read the below sections.
Getting Started#
Follow the steps in getting started and make sure you have an apiToken as outlined in that section.
Install the API client in your project.
TypeScript#
We use tsc to generate types and if you use TypeScript, you may need to match our TypeScript version if you have build errors. Check our package.json to find our TypeScript version.
Example Usage#
Below illustrates an example of a variety of methods from the API client.
Constructor#
The API client should be instantiated with your API token like so.
Methods#
All methods of the API client return an identical response of the corresponding endpoint. All endpoints respond with a consistent shape as described in the API Response section.
findPages#
A promise that communicates with and resolves a response from the findPages endpoint.
createPage#
A promise that communicates with and resolves a response from the createPage endpoint.
updatePage#
A promise that communicates with and resolves a response from the updatePage endpoint.
removePage#
A promise that communicates with and resolves a response from the removePage endpoint.
findPageQueueItems#
A promise that communicates with and resolves a response from the findPageQueueItems endpoint.
createPageQueueItem#
A promise that communicates with and resolves a response from the createPageQueueItem endpoint.
findPageLighthouseAudits#
A promise that communicates with and resolves a response from the findPageLighthouseAudits endpoint.
updateLighthouseAudit#
A promise that communicates with and resolves a response from the updateLighthouseAudit endpoint.
removeLighthouseAudit#
A promise that communicates with and resolves a response from the removeLighthouseAudit endpoint.