Back to Collection Items
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
Chilkat.Http http = new Chilkat.Http();
bool success;
// Use this online tool to generate code from sample JSON: Generate Code to Create JSON
// The following JSON is sent in the request body.
// {
// "project": {
// "vis_state": 1
// }
// }
Chilkat.JsonObject json = new Chilkat.JsonObject();
json.UpdateInt("project.vis_state",1);
// Adds the "Authorization: Bearer <access_token>" header.
http.AuthToken = "<access_token>";
http.SetRequestHeader("Content-Type","application/json");
Chilkat.StringBuilder sbRequestBody = new Chilkat.StringBuilder();
json.EmitSb(sbRequestBody);
Chilkat.HttpResponse resp = http.PTextSb("DELETE","https://my.freshbooks.com/service/api/comments/business/{{businessId}}/project/{{projectId}}",sbRequestBody,"utf-8","application/json",false,false);
if (http.LastMethodSuccess == false) {
Debug.WriteLine(http.LastErrorText);
return;
}
Chilkat.StringBuilder sbResponseBody = new Chilkat.StringBuilder();
resp.GetBodySb(sbResponseBody);
Chilkat.JsonObject jResp = new Chilkat.JsonObject();
jResp.LoadSb(sbResponseBody);
jResp.EmitCompact = false;
Debug.WriteLine("Response Body:");
Debug.WriteLine(jResp.Emit());
int respStatusCode = resp.StatusCode;
Debug.WriteLine("Response Status Code = " + Convert.ToString(respStatusCode));
if (respStatusCode >= 400) {
Debug.WriteLine("Response Header:");
Debug.WriteLine(resp.Header);
Debug.WriteLine("Failed.");
return;
}
Curl Command
curl -X DELETE
-H "Authorization: Bearer <access_token>"
-H "Content-Type: application/json"
-d '{
"project": {
"vis_state": 1
}
}'
https://my.freshbooks.com/service/api/comments/business/{{businessId}}/project/{{projectId}}
Postman Collection Item JSON
{
"name": "Delete Project",
"request": {
"method": "DELETE",
"header": [
{
"key": "Content-Type",
"name": "Content-Type",
"value": "application/json",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"project\": {\n \"vis_state\": 1\n }\n}"
},
"url": {
"raw": "https://my.freshbooks.com/service/api/comments/business/{{businessId}}/project/{{projectId}}",
"protocol": "https",
"host": [
"my",
"freshbooks",
"com"
],
"path": [
"service",
"api",
"comments",
"business",
"{{businessId}}",
"project",
"{{projectId}}"
]
}
},
"response": [
{
"name": "Delete Project",
"originalRequest": {
"method": "PUT",
"header": [
{
"key": "Content-Type",
"name": "Content-Type",
"value": "application/json",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"project\": {\n \"vis_state\": 1\n }\n}"
},
"url": {
"raw": "https://api.freshbooks.com/projects/business/{{businessId}}/projects/{{projectId}}",
"protocol": "https",
"host": [
"api",
"freshbooks",
"com"
],
"path": [
"projects",
"business",
"{{businessId}}",
"projects",
"{{projectId}}"
]
}
},
"status": "NOT FOUND",
"code": 404,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Server",
"value": "nginx"
},
{
"key": "Content-Type",
"value": "application/vnd.api+json"
},
{
"key": "X-Version",
"value": "1904.6.0"
},
{
"key": "Access-Control-Allow-Origin",
"value": "*"
},
{
"key": "Via",
"value": "1.1 google"
},
{
"key": "Via",
"value": "1.1 varnish"
},
{
"key": "Content-Length",
"value": "79"
},
{
"key": "Accept-Ranges",
"value": "bytes"
},
{
"key": "Date",
"value": "Wed, 24 Apr 2019 18:25:22 GMT"
},
{
"key": "Connection",
"value": "keep-alive"
},
{
"key": "X-Served-By",
"value": "cache-mdw17369-MDW"
},
{
"key": "X-Cache",
"value": "MISS"
},
{
"key": "X-Cache-Hits",
"value": "0"
},
{
"key": "Country",
"value": "CA"
},
{
"key": "Strict-Transport-Security",
"value": "max-age=31536000; includeSubDomains; preload"
}
],
"cookie": [
],
"body": "{\n \"error_type\": \"not_found\",\n \"message\": \"The requested resource was not found.\"\n}"
},
{
"name": "Delete Project",
"originalRequest": {
"method": "DELETE",
"header": [
{
"key": "Content-Type",
"name": "Content-Type",
"value": "application/json",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"project\": {\n \"vis_state\": 1\n }\n}"
},
"url": {
"raw": "https://my.freshbooks.com/service/api/comments/business/{{businessId}}/project/{{projectId}}",
"protocol": "https",
"host": [
"my",
"freshbooks",
"com"
],
"path": [
"service",
"api",
"comments",
"business",
"{{businessId}}",
"project",
"{{projectId}}"
]
}
},
"status": "NO CONTENT",
"code": 204,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Server",
"value": "nginx"
},
{
"key": "Content-Type",
"value": "application/vnd.api+json"
},
{
"key": "X-Version",
"value": "1904.25.0"
},
{
"key": "X-NewRelic-App-Data",
"value": "PxQBWV5TCBABVllUBAQOU10TGhE1AwE2QgNWEVlbQFtcCxYnRA9QFg1ZWU4FDFZFVRYSBxlDUhULRERQBxVNEkINUgdbTBpAVhZWFEMCVlgURFgLAwBMERxUTVIZAQFSXQYCBFpSW1cBUg9WCgoYBgJJG1IAVVBRB1BWAldTCQADU1RAG1dWChdUaw=="
},
{
"key": "Access-Control-Allow-Origin",
"value": "*"
},
{
"key": "Expires",
"value": "Tue, 24 Apr 2018 18:28:35 GMT"
},
{
"key": "Cache-Control",
"value": "no-cache"
},
{
"key": "X-Frame-Options",
"value": "SAMEORIGIN"
},
{
"key": "Via",
"value": "1.1 google"
},
{
"key": "Via",
"value": "1.1 varnish"
},
{
"key": "Accept-Ranges",
"value": "bytes"
},
{
"key": "Date",
"value": "Wed, 24 Apr 2019 18:28:35 GMT"
},
{
"key": "Connection",
"value": "keep-alive"
},
{
"key": "X-Served-By",
"value": "cache-mdw17328-MDW"
},
{
"key": "X-Cache",
"value": "MISS"
},
{
"key": "X-Cache-Hits",
"value": "0"
},
{
"key": "Country",
"value": "CA"
},
{
"key": "Strict-Transport-Security",
"value": "max-age=31536000; includeSubDomains; preload"
}
],
"cookie": [
],
"body": null
}
]
}