Back to Collection Items
' This example assumes the Chilkat API to have been previously unlocked.
' See Global Unlock Sample for sample code.
Dim http As New ChilkatHttp
Dim success As Long
' 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
' }
' }
Dim json As New ChilkatJsonObject
success = json.UpdateInt("project.vis_state",1)
' Adds the "Authorization: Bearer <access_token>" header.
http.AuthToken = "<access_token>"
http.SetRequestHeader "Content-Type","application/json"
Dim sbRequestBody As New ChilkatStringBuilder
success = json.EmitSb(sbRequestBody)
Dim resp As ChilkatHttpResponse
Set resp = http.PTextSb("DELETE","https://my.freshbooks.com/service/api/comments/business/{{businessId}}/project/{{projectId}}",sbRequestBody,"utf-8","application/json",0,0)
If (http.LastMethodSuccess = 0) Then
Debug.Print http.LastErrorText
Exit Sub
End If
Dim sbResponseBody As New ChilkatStringBuilder
success = resp.GetBodySb(sbResponseBody)
Dim jResp As New ChilkatJsonObject
success = jResp.LoadSb(sbResponseBody)
jResp.EmitCompact = 0
Debug.Print "Response Body:"
Debug.Print jResp.Emit()
Dim respStatusCode As Long
respStatusCode = resp.StatusCode
Debug.Print "Response Status Code = " & respStatusCode
If (respStatusCode >= 400) Then
Debug.Print "Response Header:"
Debug.Print resp.Header
Debug.Print "Failed."
Exit Sub
End If
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
}
]
}