Skip to content

RESTful Endpoints

Each resource you describe will be available using RESTful patterns. If you’re familiar with CRUD (Create, Read, Update, Delete), you’ll find using attainable APIs very easy.

Provided the following resource description for post:

post:
slug: string
title: string
body: string
published: datetime
categories: << category
tags: << tag

RESTful CRUD methods will be available for each resource:

GET /post
GET /post/:id:
POST /post
PUT /post/:id:
PATCH /post/:id:
DELETE /post/:id:

Each resource is also able to be queried with standard HTTP URL query fields:

GET /post?title="://attainable APIS"
GET /post?tag="resources"&tag="apis"

Each resource can be sorted using familiar :ASC and :DESC suffixes for fields. It’s possible to sort the responses using the sort query in the URL:

GET /post?sort=title:DESC
GET /post?sort=slug:ASC
GET /post?sort=createdat:DESC

You can control the size and the index of the data responses:

GET /post?size=100
GET /post?size=50&index=4

Each of the resources associations can be retrieved with a standard path pattern:

GET /post/42/tags
GET /post/42/categories

Each Attainable API has it’s resources available through automatically generated OpenAPI documentation. You can reach the documentation by using the /docs path for each API.