API / Projects

With /projects endpoint it is possible to browse and manager projects' data in Silverbucket database.



GET


When calling projects endpoint without parameters, you will get all the projects in that environment's database.


https://<your_environment>/customer-api/1.0/projects/

Example response
{
"count": 1,
"csvUrl": "/customer-api/1.0/projects/?csv=true&project.id=51",
"itemsPerPage": 500,
"excelUrl": "/customer-api/1.0/projects/?excel=true&project.id=51",
"next": null,
"current": 1,
"lastPage": 1,
"data": [
{
"id": 51,
"created": "2017-10-09T12:57:07.238950",
"modified": "2019-08-23T10:26:29.369459",
"name": "Bridge construction phase 1",
"created_date": "2017-10-09T12:57:07.238991",
"description": "Connecting far apart places",
"active": true,
"probability": 100,
"status": "green",
"invoiceable": true,
"invoice_language": "fi",
"code": "SEC999",
"extra_code": "PROJ300378",
"startdate": "2017-12-25",
"enddate": "2018-01-19",
"budget_hours_own": "1770.00",
"budget_euros_own": "1000000.00",
"budget_hours_ext": "165.00",
"budget_euros_ext": "150000.00",
"budget_euros_misc": "112.00",
"hoursheet_lock": null,
"hard_lock": null,
"invoicing_type": "invoicing_type.time_and_material",
"absence": false,
"readiness": "76.00",
"priority": 1,
"budget_hours_overrun": "1935.00",
"budget_euros_overrun": "1150112.00",
"customer": 3,
"projectlead": 65,
"project_type": 3,
"node": 15,
"invoice_defaults": null,
"program": 2,
"currency": 1,
"projecttags": [
3
],
"portfolios": [
3
]
}
],
"previous": null
}


POST


You can add projects with POST method to the same URL as GET. Minimum body for creating a new project is below and successful project creation sends back status code 201 and project's metadata in the same JSON format than GET. 
{
"customer": <customer_id>,
"projectlead": <user_id>,
"name": "<string>",
"currency": <currency_id>
}

 POST body can contain these metadatas for the project.
{
"name": "<string>",
"description": "<string>",
"active": <boolean: true|false>,
"probability": <percentage: 0-100>,
"status": "<green|yellow|red>",
"invoiceable": <boolean: true|false>,
"invoice_language": "<ISO 639-1>",
"code": "<string>",
"extra_code": "<string>",
"startdate": "<yyyy-mm-dd>",
"enddate": "<yyyy-mm-dd>",
"budget_hours_own": "<DECIMAL(10, 2)>",
"budget_euros_own": "<DECIMAL(10, 2)>",
"budget_hours_ext": "<DECIMAL(10, 2)>",
"budget_euros_ext": "<DECIMAL(10, 2)>",
"budget_euros_misc": "<DECIMAL(10, 2)>",
"hoursheet_lock": <yyyy-mm-dd>,
"hard_lock": <yyyy-mm-dd>,
"invoicing_type": "<invoicing_type.time_and_material|.fixed|.price_ceiling>",
"absence": <boolean: false|true>,
"readiness": "<DECIMAL(10, 2)>",
"priority": <INTEGER>,
"budget_hours_overrun": "<DECIMAL(10, 2)>",
"budget_euros_overrun": "<DECIMAL(10, 2)>",
"customer": <customer_id>,
"projectlead": <user_id>,
"project_type": <project_type_id>,
"node": <organization_node_id>,
"invoice_defaults": null,
"program": <program_id>,
"currency": <currency_id>,
"projecttags": [<list: project_tag_id>],
"portfolios": [<list: project_portfolio_id>]
}

Existing projects can be updated via:


curl -H "Content-Type: application/json" -H 'AUTHORIZATION: Token token_here' -X