I have been making calls to a previously free API using esriRequest
var layersRequest = esriRequest({
url: base_url,
content: {
"latitude": lat,
"longitude": long,
"riskCategory": risk,
"siteClass": siteClass,
"title":"Default"},
dataType:'jsonp',
handleAs: "json",
callbackParamName: "callback" }); ...Now the API requires a key; which I have:
const key = 'xI234fg543example23';
The above is just an **example key; not real
The API documentation says to "Include your key in the api-key field of your request headers to authenticate like this:
curl --header "api-key: [your_api_key]" -X GET "https://api-hazards.atcouncil.org/public/v1/[load_category].json?lat=[lat]&lng=[lng]"
How do I correctly apply this using esriRequest? I believe the generic javascript equivalent would be
<SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: 13px; margin: 0px;">layerRequest.</SPAN><SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: 13px; margin: 0px;">setRequestHeader</SPAN>