For users who'd like to get all active projects within Project Insight:
curl -X GET --header 'Accept: application/json' 'http://yourdomain.projectinsight.net/api/project/active'
Alternatively, you can use the project 'search' method in order to narrow and filter your results for retrieving specific projects.
curl -X GET --header 'Accept: application/json' 'http://yourdomain.projectinsight.net/api/project/search?searchText=test&isPlanning=true&customerName=abc%20company&projectNumber=101'
Another common request will be to create/update a project, so let's take a look how we can accomplish this.
curl -X POST \
https://yourdomain.projectinsight.net/api/project \
-H 'api-token: {YOUR_API_TOKEN}' \
-H 'cache-control: no-cache' \
-H 'content-type: application/json' \
-H 'postman-token: 7bcc9a68-9863-f190-aee1-a97a96c921fa' \
-d '{
"Name":"Project Created From Web Api",
"ItemContainer_Id":"30467aa7ca0142fbafdfa2c08cc8b5e1",
"ItemNumber":10002,
"Description":"This is a test item. Created using Project Insight Web Api (REST)",
"ProjectMode":1
}'
POST /api/project HTTP/1.1
Host: dev22.sandbox.projectinsight.net
api-token: {YOUR_API_TOKEN}
Content-Type: application/json
Cache-Control: no-cache
Postman-Token: a9e6c7c2-3a1f-568d-f8e5-a4f32ba2cd0c
{
"Name":"Project Created From Web Api",
"ItemContainer_Id":"30467aa7ca0142fbafdfa2c08cc8b5e1",
"ItemNumber":10002,
"Description":"This is a test item. Created using Project Insight Web Api (REST)",
"ProjectMode":1
}
var settings = {
"async": true,
"crossDomain": true,
"url": "https://dev22.sandbox.projectinsight.net/projectinsight.webapp/api/project",
"method": "POST",
"headers": {
"api-token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJpYXQiOjE0OTM0MDEwNjUsImV4cCI6MjEyNDU1MzA2NSwic3ViIjoiMGE2MGM5NzgtMTdjMi00NjYyLWE1ODQtNzFjNmI1ZGYzOGRjIn0.7jJ3yaBReBgm2PqNhq7ynAZvlpos_uDHdKDwtHZCTOxBCcpI7kG1B2xzhqNArm1BvAbxE5ny04Oo1-uWyE861Q",
"content-type": "application/json",
"cache-control": "no-cache",
"postman-token": "b1efe724-64f4-01d3-0159-ba1f64ffe6c5"
},
"processData": false,
"data": "{\r\n\"Name\":\"Project Created From Web Api\",\r\n\"ItemContainer_Id\":\"30467aa7ca0142fbafdfa2c08cc8b5e1\",\r\n\"ItemNumber\":10002,\r\n\"Description\":\"This is a test item. Created using Project Insight Web Api (REST)\",\r\n\"ProjectMode\":1\r\n}"
}
$.ajax(settings).done(function (response) {
console.log(response);
});
JavaScript jQuery AJAX example.
Comments
0 comments
Please sign in to leave a comment.