Costunits

You can list your available costunits with the following URL:

                GET https://api.smallinvoice.com/costunit/list/
            

URL Parameters

NameTypeRequiredDefaultOptionsNotes
limitintno0Limit the amount of results
pageintno1When limiting the results, specifies page
sortstringnonamenameSorts the list by the available values
sorttypestringnodescasc
desc
Defines the way of sorting


Example: Making a request with 100 Results, getting second page, and sorting by date ascending

        GET https://api.smallinvoice.com/costunit/list/limit/100/page/2/sort/date/sorttype/asc/
    

Response

NameTypeNotes
errorbooleanIs true if an error occured
errorcodeintCode of the error. Only returned if error is true.
errormessagestringInformational message about the error. Only returned if error is true.
pageintCurrent page that was passed in on the request
pagesintTotal number of pages available
countintTotal number of objects available
itemscollectionCollection of Costunit Objects

Example content of data variable:

    {
        "error":false,
        "page":1,
        "pages":1,
        "count":1,
        "items":[
            {
                "id":1,
                "name":"Lunch break",
                "description":"",
                "status":1
            }
        ]
    }
    

You can get your costunit with the following URL:

                GET https://api.smallinvoice.com/costunit/get/
            

URL Parameters

NameTypeRequiredDefaultOptionsNotes
idintyesThe Id of the costunit


Example: Making a request for costunit with id 5

                GET https://api.smallinvoice.com/costunit/get/id/5
            

Response

NameTypeNotes
errorbooleanIs true if an error occured
errorcodeintCode of the error. Only returned if error is true.
errormessagestringInformational message about the error. Only returned if error is true.
itemobjectObject of Costunit

Example content of data variable:

    {
        "error":false,
        "item":{
            "id":1,
            "name":"Lunch break",
            "description":"",
            "status":1,
            "assigns":[
                {
                    "id":4,
                    "employee":"John Doe",
                    "comment":"",
                    "hours":2,
                    "year":2013,
                    "month":2,
                    "day":26
                }
            ]
        }
    }
    

You can add a new costunit with the following URL:

                POST https://api.smallinvoice.com/costunit/add
            

Body parameters

NameTypeRequiredDefaultNotes
namestringyesName of the costunit
descriptionstringnoDescription of costunit
statusintyesSee Status Types


Example: Creating a new costunit

                POST https://api.smallinvoice.com/costunit/add/
            

Example content of data variable:
{
    "name":"Lunch break",
    "description":"",
    "status":1
}

Response

NameTypeNotes
errorbooleanIs true if an error occured
errorcodeintCode of the error. Only returned if error is true.
errormessagestringInformational message about the error. Only returned if error is true.
idintThe Id of the Costunit Object that was created

Example response:

    {
        "error":false,
        "id": 43
    }
    

You can edit an costunit with the following URL:

                POST https://api.smallinvoice.com/costunit/edit
            

URL Parameters

NameTypeRequiredDefaultOptionsNotes
idintyesThe Id of the costunit

Body parameters

NameTypeNotes
namestringName of the costunit
descriptionstringDescription of costunit
statusintSee Status Types


Example: Editing an costunit with id 5

                POST https://api.smallinvoice.com/costunit/edit/id/5
            

Example content of data variable:
{
    "name":"Lunch break",
    "description":"",
    "status":1
}

Response

NameTypeNotes
errorbooleanIs true if an error occured
errorcodeintCode of the error. Only returned if error is true.
errormessagestringInformational message about the error. Only returned if error is true.

Example response:

    {
        "error":false
    }
    

You can delete an costunit with the following URL:

                POST https://api.smallinvoice.com/costunit/delete/
            

URL Parameters

NameTypeRequiredDefaultOptionsNotes
idintyesThe Id of the costunit


Example: Making a request for deleting costunit with id 5

                POST https://api.smallinvoice.com/costunit/delete/id/5
            

Response

NameTypeNotes
errorbooleanIs true if an error occured
errorcodeintCode of the error. Only returned if error is true.
errormessagestringInformational message about the error. Only returned if error is true.

Example response:

    {
        "error":false
    }