DocsGuides

Interacting with APIs

Netzo provides a simple and intuitive way to interact with APIs. It allows you to create a client for an existing API or a custom API and provides a convenient way to make requests to the API.

Netzo provides a simple and intuitive way to interact with APIs. It allows you to create a client for an existing API or a custom API and provides a convenient way to make requests to the API.

The following basic examples show how to work with APIs.

Creat an API client

An example of connecting to an existing API, in this case the JSONPlaceholder API.

import { jsonplaceholder } from 'netzo/apis/jsonplaceholder/mod.ts'const { api } = jsonplaceholder()const users = await api.users.get()

You can visit the apis page to see a list of all the APIs that are currently supported.

API configuration options Note that different APIs might require different configuration options (see here for more information).

Create a custom API client

An example of connecting to a custom API, in this case the JSONPlaceholder API.

import { rest } from 'netzo/apis/rest/mod.ts'const api = rest({  baseURL: 'https://jsonplaceholder.typicode.com',  headers: { 'content-type': 'application/json' }})const data = await api.sales.get({ start: Date.now() })