cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Meraki API google form

Highlighted
Comes here often

Meraki API google form

hello

i just get a script from github about the automatisation through google forms

https://developer.cisco.com/meraki/build/google-forms-with-the-dashboard-api/

 

So I have followed the document, created my own google form in order to add meraki admin on the dashboard

However when i send the form, i received the following error in my trigger:

 

Cannot read property 'length' of undefined at addMerakiAdmin

 

i didn't changed anything to the script, it seems there is a kind of misconfiguration in int

 

var options =
{
"method" : "post",
"payload": payload,
"headers": headers,
"content-type": "application/json",
"contentLength": payload.length,
"followRedirects": true,
"muteHttpExceptions":true
};
response = UrlFetchApp.fetch('https://'+shard+'.meraki.com/api/v0/organizations/'+orgId+'/admins', options);
var result = JSON.parse(response.getContentText());

 

can you please help me ?

 

thanks

 

regards

 

Antoine

4 REPLIES 4
Highlighted
A model citizen

Re: Meraki API google form

Can you check payload, and see what attributes is has? What if you simply remove "contentLength": payload.length,?

Comes here often

Re: Meraki API google form

hello thanks for your answer

I tried then new error:

Exception: Valeur incorrecte pour l'attribut : Header:null (ligne 56, fichier "Code")

response = UrlFetchApp.fetch('https://'+shard+'.meraki.com/api/v0/organizations/'+orgId+'/admins', options);

 

 

Highlighted
Here to help

Re: Meraki API google form

That would indicate that you may not have populated your API key at the top of the script, or may not have populated it correctly.

Have you entered in all of the environment variables using your details, like API Key, OrgID, and Shard?

 

Highlighted
Comes here often

Re: Meraki API google form

hello yes for sure correctly populated

Welcome to the Meraki Community!
To start contributing, simply sign in with your Cisco account. If you don't yet have a Cisco account, you can sign up.