Projects

You can list your available projects with the following URL:

                GET https://api.smallinvoice.com/project/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/project/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 Project Objects

Example content of data variable:

    {
        "error":false,
        "page":1,
        "pages":1,
        "count":1,
        "items":[
            {
                "id":1,
                "name":"Project X",
                "client_id":16,
                "description":"Repairing car",
                "estimate":0,
                "status":1,
                "start":"2013-02-25"
            }
        ]
    }
    

You can get your project with the following URL:

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

URL Parameters

NameTypeRequiredDefaultOptionsNotes
idintyesThe Id of the project


Example: Making a request for project with id 5

                GET https://api.smallinvoice.com/project/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 Project

Example content of data variable:

    {
        "error":false,
        "item":{
            "id":1,
            "name":"Project X",
            "client_id":16,
            "description":"Repairing car",
            "estimate":0,
            "costperhour":0,
            "status":1,
            "start":"2013-02-25",
            "assigns":[
                {
                    "id":2,
                    "employee":"John Doe",
                    "comment":"My husband",
                    "hours":1.25,
                    "year":2013,
                    "month":2,
                    "day":28,
                    "billed":0
                }
            ]
        }
    }
    

You can add a new project with the following URL:

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

Body parameters

NameTypeRequiredDefaultNotes
namestringyesName of the project
client_idintyesClient id
descriptionstringnoDescription of project
estimatefloatnoEstimated hours in decimal format
costperhourfloatnoCost per hour in decimal format
startdatenoDate of project start


Example: Creating a new project

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

Example content of data variable:
{
    "name":"Project X",
    "client_id":16,
    "description":"Repairing car",
    "estimate":0,
    "costperhour":0,
    "start":"2013-02-25"
}

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 Project Object that was created

Example response:

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

You can edit an project with the following URL:

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

URL Parameters

NameTypeRequiredDefaultOptionsNotes
idintyesThe Id of the project

Body parameters

NameTypeNotes
namestringName of the project
client_idintClient id
descriptionstringDescription of project
estimatefloatEstimated hours in decimal format
costperhourfloatCost per hour in decimal format
statusintSee Project Statuses
startdateDate of project start


Example: Editing an project with id 5

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

Example content of data variable:
{
    "name":"Project X",
    "client_id":16,
    "description":"Repairing car",
    "estimate":0,
    "costperhour":0,
    "status":1,
    "start":"2013-02-25"
}

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 project with the following URL:

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

URL Parameters

NameTypeRequiredDefaultOptionsNotes
idintyesThe Id of the project


Example: Making a request for deleting project with id 5

                POST https://api.smallinvoice.com/project/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
    }