Skip to content

dionsnoeijen/sexy-field-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status

SexyFieldApi

This package adds endpoints for sections to SexyField.

GET requests

Sexy-field-api is very powerful when it comes to retrieving the data that you need. Out of the box you can get all the information of your entities, including parent and child entities.

Here are some examples of how you can build your GET requests.

One recipe

/v1/section/{sectionHandle}/id/{id}
/v1/section/recipe/id/15?fields=id,title,description,recipeType,created,updated

All recipes

/v1/section/{sectionHandle}
/v1/section/recipe?fields=id,title,description,recipeType,created,updated

Recipe filtered by field value

/v1/section/fieldvalue/{sectionHandle}/{fieldHandle}
/v1/section/fieldvalue/recipe/recipeType?value=vegan&fields=id,title,description

Recipe by slug

/v1/section/{sectionHandle}/slug/{slug}
/v1/section/recipe/slug/recipe-20180325?fields=title

Recipe with ingredients (show fields of child entities as well)

The child entity is indicated by the name of the property in the parent entity. So in this case the recipe entity has a property called ingredients The fields name, amount, unit are properties of the ingredient.

/v1/section/recipe/id/3?fields=id,title,description,recipeType,created,updated,ingredients,name,amount,unit

POST requests

For creating a new recipe, you would have to use a POST request to:

/v1/section/recipe

Content-Type: application/x-www-form-urlencoded

Form data:

form[title]: Black bean soup
form[description]: A delicious soup
form[recipeType]: vegan

PUT, DELETE and OPTIONS requests

See src/config/routing/api.yml

Depth control for requests that return an entry

Nex to ?fields=id,field you can add &depth=3 to control the level of depth in which data is returned.

About

Sexy field section endpoints

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages