NEW

Connect the world's APIs to Web3 with Chainlink Functions. Get started

HTTP Task

HTTP tasks make HTTP requests to arbitrary URLs.

Parameters

  • method: the HTTP method that the request should use.
  • url: the URL to make the HTTP request to.
  • requestData (optional): a statically-defined payload to be sent to the external adapter.
  • allowUnrestrictedNetworkAccess (optional): permits the task to access a URL at localhost, which could present a security risk. Note that Bridge tasks allow this by default.
  • headers (optional): an array of strings. The number of strings must be even. Example: foo [type=http headers="[\\"X-Header-1\\", \\"value1\\", \\"X-Header-2\\", \\"value2\\"]"]

Outputs

A string containing the response body.

Example

my_http_task [type="http"
              method=PUT
              url="http://chain.link"
              requestData="{\\"foo\\": $(foo), \\"bar\\": $(bar), \\"jobID\\": 123}"
              allowUnrestrictedNetworkAccess=true
              ]

Stay updated on the latest Chainlink news