Lua
Lua
MYOB: Delete a Category
See more MYOB Examples
Sends a DELETE to delete a category.Chilkat Lua Downloads
local chilkat = require("chilkat")
-- This example assumes the Chilkat API to have been previously unlocked.
-- See Global Unlock Sample for sample code.
local http = chilkat.Http.new()
-- Implements the following CURL command:
-- curl --request DELETE "https://ar1.api.myob.com/accountright/c06778dd-4371-4a83-975f-522df65d7574/GeneralLedger/Category/{{category_id}}" \
-- --header "Authorization: Bearer ACCESS_TOKEN" \
-- --header "x-myobapi-key: This is your API Key" \
-- --header "x-myobapi-version: v2" \
-- --header "Accept-Encoding: gzip,deflate"
http:set_request_header("Authorization", "Bearer ACCESS_TOKEN")
http:set_request_header("x-myobapi-key", "This is your API Key")
http:set_request_header("Accept-Encoding", "gzip,deflate")
http:set_request_header("x-myobapi-version", "v2")
local resp = chilkat.HttpResponse.new()
local success = http:http_no_body("DELETE", "https://ar1.api.myob.com/accountright/c06778dd-4371-4a83-975f-522df65d7574/GeneralLedger/Category/{{category_id}}", resp)
if not success then
print(http.last_error_text)
return
end
local respStatusCode = resp.status_code
print("Response Status Code = " .. respStatusCode)
if respStatusCode ~= 200 then
print("Response Header:")
print(resp.header)
print("Response Body:")
print(resp.body_str)
print("Failed.")
return
end
print("Success.")