2017 © Pedro Peláez
 

library sexy-field-api

This package adds api functionality to sections.

image

tardigrades/sexy-field-api

This package adds api functionality to sections.

  • Thursday, July 26, 2018
  • by dion.snoeijen
  • Repository
  • 3 Watchers
  • 0 Stars
  • 725 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 6 Forks
  • 4 Open issues
  • 16 Versions
  • 52 % Grown

The README.md

Build Status, (*1)

SexyFieldApi

This package adds endpoints for sections to SexyField., (*2)

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., (*3)

Here are some examples of how you can build your GET requests., (*4)

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., (*5)

/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:, (*6)

/v1/section/recipe

Content-Type: application/x-www-form-urlencoded, (*7)

Form data:, (*8)

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

PUT, DELETE and OPTIONS requests

See src/config/routing/api.yml, (*9)

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., (*10)

The Versions