Skip to main content
Example on Building your first API definition

Defining APIs

Aleksi Hytönen avatar
Written by Aleksi Hytönen
Updated over 10 months ago

Building your first API definition

In this course, we will use a sample OpenAPI Specification that defines a simple Time API. The Time API has a single operation, GET /api/time/v1/now, which allows users to request the current date and time. This API does not use authentication for simplicity, so anyone who knows the API's address can access it.

We will not go into all the details of the OpenAPI Specification at this point. Our example API, the Time API, is straightforward, and in the course "Building Frends APIs," you will learn more about the OpenAPI Specification.

OpenAPI Specification of Time API

openapi: 3.0.1 info: title: Time API description: API providing current time version: 1.0.0 servers: - url: /api/time/v1 paths: /now: get: parameters: - name: format in: query description: Format in wich the current date/time should be returned required: false schema: type: string responses: '200': description: ok content: application/text: schema: type: string

To copy the OpenAPI Specification of Time API to your Frends Environment, follow these steps:

  1. Copy the initial OpenAPI Specification of Time API to your clipboard.

  2. Open the web page containing the initial OpenAPI Specification in a new browser tab or window.

  3. In the APIs List View, choose the Development Agent Group and click the "+ Create new" button to create a new API.

  4. Remove the default OpenAPI Specification for Sample API and paste the OpenAPI Specification of Time API from your clipboard.

  5. Click "Save changes" to save the Time API.

Note that the OpenAPI Specification alone does not do anything; we still need to create the API implementation. In the next step, we'll use a Frends Process to create the API implementation that will run when the Time API's GET /now operation is called by API clients.

Did this answer your question?