5 years ago
How to post an API key on a header with the post() method using Groovy?
I'm trying to write a script in Groovy that makes an API request to check the status of VPN tunnels. I've been trying the implement the post() method from the HTTP library to update the header of the url with the API key. I keep running into an error "no signature on method". This is my code so far.
import com.santaba.agent.groovyapi.http.*;
ip = "api-mp.meraki.com";
httpClient = HTTP.open(ip, 443);
url = "https://"+ip+"/api/v1/organizations/999999/appliance/vpn/statuses";
def postResponse = httpClient.post(url,["X-Cisco-Meraki-API-Key":"ApiKey"]);
I just followed the example from this tutorial: https://www.logicmonitor.com/support/terminology-syntax/scripting-support/access-a-website-from-groovy
I'm wondering if I'm getting the error because I'm not inserting a payload in my method. But I don't have a payload... I'm just trying to update the header.