Chilkat Online Tools

Unicode C++ / New FreshBooks / Delete Bill

Back to Collection Items

void ChilkatSample(void)
    {
    json.UpdateInt(L"bill.vis_state",1);    http.put_AuthToken(L"<access_token>");    json.EmitSb(sbRequestBody);    resp->GetBodySb(sbResponseBody);    jResp.LoadSb(sbResponseBody);    jResp.put_EmitCompact(false);    jResp.put_I(i);    i = i + 1;    i = 0;    count_i = jResp.SizeOfArray(L"response.result.bill.lines");    jResp.put_I(i);    amountAmount = jResp.stringOf(L"response.result.bill.lines[i].amount.amount");    amountCode = jResp.stringOf(L"response.result.bill.lines[i].amount.code");    Category = jResp.stringOf(L"response.result.bill.lines[i].category.category");    Categoryid = jResp.IntOf(L"response.result.bill.lines[i].category.categoryid");    categoryCreated_at = jResp.stringOf(L"response.result.bill.lines[i].category.created_at");    categoryId = jResp.IntOf(L"response.result.bill.lines[i].category.id");    Is_cogs = jResp.BoolOf(L"response.result.bill.lines[i].category.is_cogs");    Is_editable = jResp.BoolOf(L"response.result.bill.lines[i].category.is_editable");    Parentid = jResp.stringOf(L"response.result.bill.lines[i].category.parentid");    categoryUpdated_at = jResp.stringOf(L"response.result.bill.lines[i].category.updated_at");    categoryVis_state = jResp.IntOf(L"response.result.bill.lines[i].category.vis_state");    description = jResp.stringOf(L"response.result.bill.lines[i].description");    id = jResp.IntOf(L"response.result.bill.lines[i].id");    list_index = jResp.IntOf(L"response.result.bill.lines[i].list_index");    quantity = jResp.stringOf(L"response.result.bill.lines[i].quantity");    tax_amount1 = jResp.stringOf(L"response.result.bill.lines[i].tax_amount1");    tax_amount2 = jResp.stringOf(L"response.result.bill.lines[i].tax_amount2");    tax_authorityid1 = jResp.stringOf(L"response.result.bill.lines[i].tax_authorityid1");    tax_authorityid2 = jResp.stringOf(L"response.result.bill.lines[i].tax_authorityid2");    tax_name1 = jResp.stringOf(L"response.result.bill.lines[i].tax_name1");    tax_name2 = jResp.stringOf(L"response.result.bill.lines[i].tax_name2");    tax_percent1 = jResp.stringOf(L"response.result.bill.lines[i].tax_percent1");    tax_percent2 = jResp.stringOf(L"response.result.bill.lines[i].tax_percent2");    total_amountAmount = jResp.stringOf(L"response.result.bill.lines[i].total_amount.amount");    total_amountCode = jResp.stringOf(L"response.result.bill.lines[i].total_amount.code");    unit_costAmount = jResp.stringOf(L"response.result.bill.lines[i].unit_cost.amount");    unit_costCode = jResp.stringOf(L"response.result.bill.lines[i].unit_cost.code");    i = i + 1;
    }

Curl Command

curl -X PUT
	-H "Authorization: Bearer <access_token>"
	-d '{
    "bill": {
        "vis_state": 1
    }
}'
https://api.freshbooks.com/accounting/account/{{accountId}}/bills/bills/{{billId}}

Postman Collection Item JSON

{
  "name": "Delete Bill",
  "request": {
    "method": "PUT",
    "header": [
    ],
    "body": {
      "mode": "raw",
      "raw": "{\n    \"bill\": {\n        \"vis_state\": 1\n    }\n}",
      "options": {
        "raw": {
          "language": "json"
        }
      }
    },
    "url": {
      "raw": "https://api.freshbooks.com/accounting/account/{{accountId}}/bills/bills/{{billId}}",
      "protocol": "https",
      "host": [
        "api",
        "freshbooks",
        "com"
      ],
      "path": [
        "accounting",
        "account",
        "{{accountId}}",
        "bills",
        "bills",
        "{{billId}}"
      ]
    }
  },
  "response": [
    {
      "name": "Delete Bill",
      "originalRequest": {
        "method": "PUT",
        "header": [
        ],
        "body": {
          "mode": "raw",
          "raw": "{\n    \"bill\": {\n        \"vis_state\": 1\n    }\n}",
          "options": {
            "raw": {
              "language": "json"
            }
          }
        },
        "url": {
          "raw": "https://api.freshbooks.com/accounting/account/{{accountId}}/bills/bills/{{billId}}",
          "protocol": "https",
          "host": [
            "api",
            "freshbooks",
            "com"
          ],
          "path": [
            "accounting",
            "account",
            "{{accountId}}",
            "bills",
            "bills",
            "{{billId}}"
          ]
        }
      },
      "status": "OK",
      "code": 200,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "Server",
          "value": "nginx"
        },
        {
          "key": "Date",
          "value": "Fri, 09 Oct 2020 15:41:35 GMT"
        },
        {
          "key": "Content-Type",
          "value": "application/json"
        },
        {
          "key": "Vary",
          "value": "Accept-Encoding"
        },
        {
          "key": "X-NewRelic-App-Data",
          "value": "PxQBWV5TCBABVlVSAwEOVlcTGhE1AwE2QgNWEVlbQFtcCxYnRA9QFg1ZWU4DFVdfRgFPCkNFR0gGWFpfEVwBC1wOGk4IFAQcAFEJUQRSA1pVAwZTUlYJAgdIVVQbEwRfUAMGBgRUWlAIUwBQXAAWHlUEVRJUPA=="
        },
        {
          "key": "X-Frame-Options",
          "value": "SAMEORIGIN"
        },
        {
          "key": "X-XSS-Protection",
          "value": "1; mode=block"
        },
        {
          "key": "X-Content-Type-Options",
          "value": "nosniff"
        },
        {
          "key": "Content-Security-Policy",
          "value": "default-src 'self'"
        },
        {
          "key": "X-Content-Security-Policy",
          "value": "default-src 'self'"
        },
        {
          "key": "Strict-Transport-Security",
          "value": "max-age=31556926; includeSubDomains; preload"
        },
        {
          "key": "Referrer-Policy",
          "value": "strict-origin-when-cross-origin"
        },
        {
          "key": "X-RateLimit-Limit",
          "value": "600"
        },
        {
          "key": "X-RateLimit-Remaining",
          "value": "599"
        },
        {
          "key": "X-RateLimit-Reset",
          "value": "1602258156"
        },
        {
          "key": "Retry-After",
          "value": "60"
        },
        {
          "key": "Access-Control-Allow-Origin",
          "value": "*"
        },
        {
          "key": "Content-Encoding",
          "value": "gzip"
        },
        {
          "key": "Via",
          "value": "1.1 google"
        },
        {
          "key": "Alt-Svc",
          "value": "h3-Q050=\":443\"; ma=2592000,h3-Q046=\":443\"; ma=2592000,h3-Q043=\":443\"; ma=2592000,quic=\":443\"; ma=2592000; v=\"46,43\""
        },
        {
          "key": "Transfer-Encoding",
          "value": "chunked"
        }
      ],
      "cookie": [
      ],
      "body": "{\n    \"response\": {\n        \"result\": {\n            \"bill\": {\n                \"amount\": {\n                    \"amount\": \"5.00\",\n                    \"code\": \"CAD\"\n                },\n                \"attachment\": null,\n                \"bill_number\": null,\n                \"bill_payments\": [],\n                \"created_at\": \"2020-10-07 21:33:27\",\n                \"currency_code\": \"CAD\",\n                \"due_date\": \"2020-11-06\",\n                \"due_offset_days\": 30,\n                \"id\": 3,\n                \"issue_date\": \"2020-10-07\",\n                \"language\": \"en\",\n                \"lines\": [\n                    {\n                        \"amount\": {\n                            \"amount\": \"5.00\",\n                            \"code\": \"CAD\"\n                        },\n                        \"category\": {\n                            \"category\": \"Advertising\",\n                            \"categoryid\": 65688,\n                            \"created_at\": \"2016-11-17 14:22:35\",\n                            \"id\": 65688,\n                            \"is_cogs\": true,\n                            \"is_editable\": false,\n                            \"parentid\": null,\n                            \"updated_at\": \"2020-08-14 12:52:33\",\n                            \"vis_state\": 0\n                        },\n                        \"description\": \"Food\",\n                        \"id\": 5,\n                        \"list_index\": 1,\n                        \"quantity\": \"1\",\n                        \"tax_amount1\": null,\n                        \"tax_amount2\": null,\n                        \"tax_authorityid1\": null,\n                        \"tax_authorityid2\": null,\n                        \"tax_name1\": null,\n                        \"tax_name2\": null,\n                        \"tax_percent1\": null,\n                        \"tax_percent2\": null,\n                        \"total_amount\": {\n                            \"amount\": \"5.00\",\n                            \"code\": \"CAD\"\n                        },\n                        \"unit_cost\": {\n                            \"amount\": \"5.00\",\n                            \"code\": \"CAD\"\n                        }\n                    },\n                    {\n                        \"amount\": {\n                            \"amount\": \"0.00\",\n                            \"code\": \"CAD\"\n                        },\n                        \"category\": {\n                            \"category\": \"Advertising\",\n                            \"categoryid\": 65688,\n                            \"created_at\": \"2016-11-17 14:22:35\",\n                            \"id\": 65688,\n                            \"is_cogs\": true,\n                            \"is_editable\": false,\n                            \"parentid\": null,\n                            \"updated_at\": \"2020-08-14 12:52:33\",\n                            \"vis_state\": 0\n                        },\n                        \"description\": null,\n                        \"id\": 7,\n                        \"list_index\": 2,\n                        \"quantity\": \"1\",\n                        \"tax_amount1\": null,\n                        \"tax_amount2\": null,\n                        \"tax_authorityid1\": null,\n                        \"tax_authorityid2\": null,\n                        \"tax_name1\": null,\n                        \"tax_name2\": null,\n                        \"tax_percent1\": null,\n                        \"tax_percent2\": null,\n                        \"total_amount\": {\n                            \"amount\": \"0.00\",\n                            \"code\": \"CAD\"\n                        },\n                        \"unit_cost\": {\n                            \"amount\": \"0.00\",\n                            \"code\": \"CAD\"\n                        }\n                    }\n                ],\n                \"outstanding\": {\n                    \"amount\": \"5.00\",\n                    \"code\": \"CAD\"\n                },\n                \"overall_category\": \"Advertising\",\n                \"overall_description\": \"Food\",\n                \"paid\": {\n                    \"amount\": \"0.00\",\n                    \"code\": \"CAD\"\n                },\n                \"status\": \"unpaid\",\n                \"tax_amount\": {\n                    \"amount\": \"0.00\",\n                    \"code\": \"CAD\"\n                },\n                \"total_amount\": {\n                    \"amount\": \"5.00\",\n                    \"code\": \"CAD\"\n                },\n                \"updated_at\": \"2020-10-09 15:41:35\",\n                \"vis_state\": 1\n            }\n        }\n    }\n}"
    }
  ]
}