dcHttpExt icon


A simple API client

Registered StackHub users may elect to receive email notifications whenever a new package version is released.

There are 6 watchers.



The Pod provides the Axon function - dcHttp(). The function provides a simple, lightweight, implementation for REST API calls. The method can be used to retrieve or create new records at an external API address. Users of this extension are welcome to use, edit and add to the extension and related source code as they see fit.


  • dcHttp(uri,headers,body,method)
  • uri - enclosed with ` characters.
  • method - Must be a of type string, either GET or POST. Cannot be null.
  • headers - Must be one of; an empty dict, a dict of key-value pairs, or null.
  • body - Must be of type string, or null. If dict is required for body data (Common to have json body data for an api request), the dict must be enclosed all in a string, then use escape characters for the inner quotations (see code example 2). If body data is present, header must contain a content-type header (typically "application/json").
  • reurn type - The response body of the call, as type String. At this stage, other response data is only availabe implicitly.
  • dcHttpResponse(uri,headers,body,method)
  • Use the same as dcHttp().
  • Returns a dict with keys "responseString" and "responseCode".
  • accessing responseString will return what dcHttp method returns.
  • accessing responseCode will return the HTTP calls response status.


  1. We perform a "GET" request and check the status returned.
    () => do
      uri: `https://exampleblog/posts/5`
      method: "GET"
      headers: null
      body: null
      code: dcHttpResponse(uri,headers,body,method)["responseCode"]
      return code
  2. We perform a "GET" request to our blogs api, no headers or body are provided.
    () => do
      uri: `https://exampleblog/posts/5`
      method: "GET"
      headers: null
      body: null
      return dcHttp(uri,headers,body,method)
  3. We perform a "POST" request to our blogs api, to create a new record. A content type is specified in the header, with body data described as a string enclosed dictionary.
    () => do
      uri: `https://exampleblog.com/new`
      method: "POST"
      headers: {"Content-Type":"application/json"}
      body: "{\"key1\":\"value1\",\"key2\":\"value2\"}"
      return dcHttp(uri,headers,body,method)
Published by Direct Control
Package details
Build date2 years ago
on 5th Oct 2021
Requirements SkySpark v3.1
Depends on
File namedcHttpExt.pod
File size8.89 kB
SHA1 e1e998e4eeeb9b60cebf248c79a99d58eb64efb1
Published by
Direct ControlDownload now
Also available via SkyArc Install Manager
Pod File