HTTP JSON Endpoints

View as Markdown

Fern Definition isn’t recommended for new customers and Fern isn’t accepting feature requests for this format. It remains supported for existing users.

Endpoints in Fern are defined underneath the endpoints key. Below is an example of defining a single REST endpoint:

users.yml
1service:
2 base-path: /users
3 auth: false
4 endpoints:
5 createUser:
6 path: /create
7 method: POST
8 request:
9 body:
10 properties:
11 userName: string

Examples

You can provide examples of requests and responses by using the examples key.

1service:
2 base-path: /users
3 auth: false
4 endpoints:
5 getUser:
6 path: /{userId}
7 path-parameters:
8 userId: string
9 method: GET
10 response: User
11 examples:
12 - path-parameters:
13 userId: alice-user-id
14 response:
15 body:
16 userId: alice-user-id
17 name: Alice