Faveo widgets allow admin to add social media icons and custom footer widgets in the client panel. The APIs are exclusively accessible by Admin users. Both social media icons and footer widgets can be accessed via the same API by just passing type slug to inform the system which widget record we want to access.
Get widget views
Route: widgets/{type}
replace the type with”social-icon” if you want to get a social widget list page, the default type is footer which returns the footer widget list page.
Response: HTML view
Get widget List
API to get all widget list record.
Route: api/list-widgets/{type?}
where {type?} is an optional slug if not passed then all widgets (social-icon and footers) will be returned in the response. Possible values for type slug are
- social-icon: to return only social widget list
- footer: to return only footer widget list
parameters
Parameter | type | Required | description |
sort-order | string | no | The direction of sorting the result data ‘asc’ or ‘desc’. Default ‘asc’ |
search-query | string | no | term to search and filter the result data |
limit | integer | no | Number of records to fetch as result data |
page | integer | no |
Example response
call : http://www.faveo.pro/api/list-widgets/footer
{ "success": true, "data": { "current_page": 1, "widgets": [{ "id": 1, "name": "footer1", "title": null, "value": null, "created_at": "2020-03-30 03:53:13", "updated_at": "2020-03-30 04:16:58", "type": "footer" }, { "id": 2, "name": "footer2", "title": null, "value": null, "created_at": "2020-03-30 03:53:13", "updated_at": "2020-03-30 04:16:58", "type": "footer" }, { "id": 3, "name": "footer3", "title": "shivani", "value": "dsada", "created_at": "2020-03-30 03:53:13", "updated_at": "2020-03-30 08:28:01", "type": "footer" }, { "id": 4, "name": "footer4", "title": null, "value": null, "created_at": "2020-03-30 03:53:13", "updated_at": "2020-03-30 04:16:58", "type": "footer" }], "first_page_url": "http:\/\/www.faveo.pro\/api\/list-widgets\/footer?page=1", "from": 1, "last_page": 1, "last_page_url": "http:\/\/www.faveo.pro\/api\/list-widgets\/footer?page=1", "next_page_url": null, "path": "http:\/\/www.faveo.pro\/api\/list-widgets\/footer", "per_page": 10, "prev_page_url": null, "to": 4, "total": 4 } }
Update widget content
API to update the widget list record’s title and value.
Route: api/update-widget/{widget}
where {widget} is a required slug which accepts interger id of the widget record.
Parameters
Parameter | type | Required | description |
title | string | yes | the string value can be an empty string too |
value | string | yes | the string value can be an empty string too. In case of social-icon widget value must be a valid URL or an empty string |
Example response
call: http://www.faveo.pro/api/update-widget/13?value=something&title=facebook
status code: 412
{ "success": false, "message": "The value format is invalid." }
call: http://www.faveo.pro/api/update-widget/13?value=https://www.facebook.com/udaipurfreelancers&title=facebook
status code: 200
{ "success": true, "message": "Updated successfully" }