Home / Digitec Coding Practices / REST API
REST API Standards
-
All URL paths must be dashed and lowercase.
-
All URL parameters (POST, GET, etc) must be underscored and lowercase:
snake_case
. -
All entities of the same type must have a common schema with a minimum set of properties.
-
Extra properties can be requested using the following notation:
resource-endpoint:(extra-property1, extra-property2)
- Extra properties can be sub-collections, relationships etc of the main resource.
-
Updating or creating an entity should return the entity if discreet (i.e. tagging an asset will not return the tag or the asset but creating a tag will return the tag).
HTTP | Route | Action |
---|---|---|
POST |
/resources |
create resource, properties in json payload |
GET |
/resources |
get resource collection |
GET |
/resources?filter=:filter_param |
get filtered resource collection |
GET |
/resources/:id |
get single resource |
DELETE |
/resources/:id |
delete single resource |
DELETE |
/resources/:id?recursive=:boolean |
delete single resource, additional parameters in GET string |
PATCH |
/resources/:id |
update resource |
POST |
/resources/:id/link |
link resource to specified resource(s), in payload [] |
POST |
/resources/:id/unlink |
unlink resource to specified resource(s), in payload [] |