Action | HTTP | Payload | URL | Description |
---|---|---|---|---|
Create | POST | json | /<resource> | Create an entity represented by the JSON payload. |
Read | GET | - | /<resource> | Get all entities from the resource. |
Read | GET | - | /<resource>/<id> | Get a single entity. |
Update | PUT | json | /<resource>/<id> | Update an entitiy with the JSON payload. |
Delete | DELETE | - | /<resource>/<id> | Delete an entity. |
A unique API endpoint has been created for you at the address below. You can append any REST resource to it and issue a request. CrudCrud will automatically create the resource.
For example, let's say you are building a "Unicorn Farm" application and it needs to Create, Read, Update and Delete (CRUD) unicorn records like this one:
{ "name":"Sparkle Angel", "age":2, "colour":"blue" }
To create a unicorn, your application needs to issue a POST request with the unicorn JSON payload to a REST API. The name unicorns sounds like a good name for the REST resource, so append it to your endpoint to get:
https://crudcrud.com/api/7574710c668b4ae8a0a80353d23f1df3/unicorns
Every time you click the button a POST request will be sent to your endpoint to create a new unicorn. To get all unicorns created so far, you can issue a GET request using your browser by going to the address of the REST endpoint .
Note that every unicorn record gets a unique _id property generated by CrudCrud to make sure there is always a way to refer to individual objects. Use this identifier when you want to read (GET), update (PUT) or delete (DELETE) individual entities from your resources. See the Summary Table for details.