Costunits
You can list your available costunits with the following URL:
GET https://api.smallinvoice.com/costunit/list/
URL Parameters
Name | Type | Required | Default | Options | Notes |
---|---|---|---|---|---|
limit | int | no | 0 | Limit the amount of results | |
page | int | no | 1 | When limiting the results, specifies page | |
sort | string | no | name | name | Sorts the list by the available values |
sorttype | string | no | desc | asc 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
Name | Type | Notes |
---|---|---|
error | boolean | Is true if an error occured |
errorcode | int | Code of the error. Only returned if error is true. |
errormessage | string | Informational message about the error. Only returned if error is true. |
page | int | Current page that was passed in on the request |
pages | int | Total number of pages available |
count | int | Total number of objects available |
items | collection | Collection 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
Name | Type | Required | Default | Options | Notes |
---|---|---|---|---|---|
id | int | yes | The Id of the costunit |
Example: Making a request for costunit with id 5
GET https://api.smallinvoice.com/costunit/get/id/5
Response
Name | Type | Notes |
---|---|---|
error | boolean | Is true if an error occured |
errorcode | int | Code of the error. Only returned if error is true. |
errormessage | string | Informational message about the error. Only returned if error is true. |
item | object | Object 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
Name | Type | Required | Default | Notes |
---|---|---|---|---|
name | string | yes | Name of the costunit | |
description | string | no | Description of costunit | |
status | int | yes | See 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
Name | Type | Notes |
---|---|---|
error | boolean | Is true if an error occured |
errorcode | int | Code of the error. Only returned if error is true. |
errormessage | string | Informational message about the error. Only returned if error is true. |
id | int | The 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
Name | Type | Required | Default | Options | Notes |
---|---|---|---|---|---|
id | int | yes | The Id of the costunit |
Body parameters
Name | Type | Notes |
---|---|---|
name | string | Name of the costunit |
description | string | Description of costunit |
status | int | See 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
Name | Type | Notes |
---|---|---|
error | boolean | Is true if an error occured |
errorcode | int | Code of the error. Only returned if error is true. |
errormessage | string | Informational 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
Name | Type | Required | Default | Options | Notes |
---|---|---|---|---|---|
id | int | yes | The Id of the costunit |
Example: Making a request for deleting costunit with id 5
POST https://api.smallinvoice.com/costunit/delete/id/5
Response
Name | Type | Notes |
---|---|---|
error | boolean | Is true if an error occured |
errorcode | int | Code of the error. Only returned if error is true. |
errormessage | string | Informational message about the error. Only returned if error is true. |
Example response:
{ "error":false }