Takes three parameters Method, URL, Body
Description:
CFApi$ Top Query function simplifies API calls to api.CloudFlare.com by automatically building much of the request; allowing only the specifics unique to that call to be provided.
Parameters:
At this time, current versions of Moxie.Build default Setup$ "Cnw.CF.BaseURL" to "//api.cloudflare.com/client/v4/zones".
HTTP Headers:
The Setup Table values of "Cnw.CF.Email" and "Cnw.CF.Key" need to be populated with your CloudFlare account information in order for the CFApi$ command to work. Moxie.Build will encrypt the "Cnw.CF.Key" value in the Setup Table and the CFApi$ command will automatically decrypt it. "Cnw.CF.Key" must be set last, after "Cnw.CF.Email" and Cnw.CF.ZoneID".
The CFApi$ function will automatically add the three HTTP headers of "X-Auth-Email" populated with Setup$ "Cnw.CF.Email", "X-Auth-Key" populated with Setup$ "Cnw.CF.Key", and "Content-Type: application/json"
Function Return:
The functions returns the raw JSON data
Examples:
'List Subscriptions, using a full URL starting with //
JsonResp = CFApi$ "", "//api.cloudflare.com/client/v4/accounts/01a7362d577a6c3019a474fd6f485823/subscriptions", ""
'List Zones, using empty URL to fill with Setup$ "Cnw.CF.BaseURL"
JsonResp = CFApi$ "", "", ""
'Create Zone, using empty URL to fill with Setup$ "Cnw.CF.BaseURL"
JsonResp = CFApi$ "POST", "", "{""name"":""test.com"",""account"":{""id"":""01a7362d577a6c3019a474fd6f485823"",""name"":""DemoAccount""},""jump_start"":true}"
'List DNS Records for a Zone, with URL starting with # to fill with Setup$ "Cnw.CF.BaseURL" and Setup$ "Cnw.CF.ZoneID"
JsonResp = CFApi$ "", "#/dns_records", ""
'Update DNS Record for a Zone, with URL starting with # to fill with Setup$ "Cnw.CF.BaseURL" and Setup$ "Cnw.CF.ZoneID"
JsonResp = CFApi$ "PUT", "#/dns_records/372e67954025e0ba6aaa6d586b9e0b59", "{""type"":""A"",""name"":""test.com"",""content"":""127.0.0.1""}"