Interacting with external resources
Digital Writer includes a resource proxy which enables plugins to make HTTP requests to external resources, even when the Writer is hosted in an IP-locked environment.
In order to reach an external source the plugin should use the built in Router-instance which is exposed on the writer.router-property. This router-property contains functions for the normal HTTP methods, get() post(), del(), and put().
api.router.post(string path, object parameters)api.router.put(string path, object parameters)api.router.get(string path, object parameters)api.router.del(string path, object parameters)
path and parameters specification
path and parameters specificationpathis a string which should point to an internal Writer API resource. For the purposesof interacting with external sources,
pathshould be'/api/resourceproxy'parametersis an object which is converted to a querystring and is appended to thepathparameter.Use the
url-property to define which external resource to fetchThe
headers, andbody-properties are forwarded to the external resourceAdd a
x-append-authorization-property toheaders-property to forward any Authorizationinformation to the external resource
Simple GET of external resource
Simple POST to external resource
Simple request of external resource with added header
POST with Authorization header using resourceproxy
resourceproxyGET with Authorization header using resourceproxy
resourceproxyWas this helpful?