Skip to content

Option API

Anton Alexeev edited this page Mar 29, 2018 · 4 revisions

METHOD GET: /{admin_route_prefix}/option

Get List of opiton

Query params for list filtering:

QUERY

id        : integer
poll_id   : integer
position  : integer
title     : string

RETURN JSON

{
  "current_page":1,
  "data":[
     {
       "id":1,
       "poll_id":1,
       "title": "Messi",
       "position": 1,
       "votesCount":0,
       "totalWeight":0
     },...
  ],
  "first_page_url":"http:\/\/localhost\/option?page=1",
  "from":1,
  "last_page":1,
  "last_page_url":"http:\/\/localhost\/option?page=1",
  "next_page_url":null,
  "path":"http:\/\/localhost\/option",
  "per_page":50,
  "prev_page_url":null,
  "to":2,
  "total":2
}

METHOD POST: /{admin_route_prefix}/option

Make a option

FORM-DATA PARAMS

poll_id:  integer
title*:   string
position: integer

field with * are required

RETURN JSON

{
   id:1,
   poll_id: 1
   title:"Messi",
   position:1
}

METHOD GET: /{admin_route_prefix}/option/{id}

Get option

RETURN JSON

{
   "id":1,
   "poll_id": 1
   "title": "Messi",
   "position":1,
   "votesCount":0,
   "totalWeight":0
}

METHOD PUT: /{admin_route_prefix}/option/{id}

Update a option

FORM-DATA PARAMS

poll_id:  integer
title*:   string
position: integer

field with * are required

RETURN JSON

{
   id:1,
   poll_id: 1
   title:"Ronaldo",
   position:1
}

METHOD DELETE: /{admin_route_prefix}/option/{id}

Delete a option

RETURN JSON

{"success":true}