create
It will create new record on table.
#
Json bodyPOST | api.example.com/table
Record will be pass as json body with POST
method
{ "name":"Rohit"}
it will create new records in users
table with name(column) Rohit(value).
return when success
{ "status":true, "message":"Records added successfully"}
#
Form dataIf you want to send data from form
& want to upload files, you have to use form requeste. Image upload will only work in form data. Here you have to use parameter form=true
, and for image image=file_field_name
.
#
Data OnlyPOST | api.example.com/table?form=true
it will create new records in users
table with all field which is recived from source.
return when success
{ "status":true, "message":"Records added successfully"}
#
Data and ImagesPOST | api.example.com/table?form=true&image=profile_pic
Make sure you are using Accept-Encoding
header, when uploads file.
Note: profile_pic is name of field and database column also. it will received image from profile_pic(input form) and will store name of file to profile_pic(table's column). you can upload multiple image by passing by comma like this image=profile_pic,cover,mycard
File will be uploaded at root/uploads
folder with random name.
return when success
{ "status":true, "message":"Records added successfully"}
You will access image with this both url
http://media.example.com/your_image.jpg
http://example.com/uploads/your_image.jpg