Skip to navigation

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
service:
base-path: /users
auth: false
endpoints:
createUser:
path: /create
method: POST
request:
body:
properties:
userName: string

Examples

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

service:
base-path: /users
auth: false
endpoints:
getUser:
path: /{userId}
path-parameters:
userId: string
method: GET
response: User
examples:
- path-parameters:
userId: alice-user-id
response:
body:
userId: alice-user-id
name: Alice