Resource Controllers

Most resources in the Playbetr API have standard resource controllers. A resource controller provides methods to list all of the resources, view a single resource, create a resource, update a resource, and delete a resource.

Resource Controller Methods

Create

URL

{resource}

Method

POST

Data Params

The data params must match the definition of the particular resource you want to create.

Success Response

Code: 200
Data:

{
    "error": false,
    "data": {RESOURCE_OBJECT},
    "meta": []
}

View

URL

{resource}/{resource_id}

Method

GET

Success Response

Code: 200
Data:

{
    "error": false,
    "data": {RESOURCE_OBJECT},
    "meta": []
}

List

URL

{resource}

Method

GET

Success Response

Code: 200
Data:

{
    "error": false,
    "data": [
                {RESOURCE_OBJECT}...
        ],  
        "meta": {
        "pagination": {
            "current_page": 1,
            "from": null,
            "last_page": 0,
            "next_page_url": null,
            "path": "http:\/\/api.dev.playbetr.com\/api\/v1\/{resource}",
            "per_page": 15,
            "prev_page_url": null,
            "to": null,
            "total": 0
        }
    }
}

Update

URL

{resource}/{resource_id}

Method

PUT

Data Params

The data params must match the definition of the particular resource you want to create.

Success Response

Code: 200
Data:

{
    "error": false,
    "data": {RESOURCE_OBJECT},
    "meta": []
}

Delete

URL

{resource}/{resource_id}

Method

DELETE

Success Response

Code: 200
Data:

{
    "error": false,
    "data": [
        1
    ],
    "meta": []
}