Set splash page URL in network templet's with API

lmgrdich
Comes here often

Set splash page URL in network templet's with API

Hello,

 

We are trying to set the splash page URL on a network template.

We are getting the below errors:

response = HTTParty.get(
headers: {"X-Cisco-Meraki-API-Key" => site.api_key}
)
ssid_details = JSON.parse(response.body)
response = HTTParty.put(
headers: {"X-Cisco-Meraki-API-Key" => site.api_key, "Content-Type" => "application/json"},
body: ssid_details.to_json
)
 
RESPONSE: #<HTTParty::Response:0x59c8fd8 parsed_response={"errors"=>["IP assignment mode setting overrides are not supported for template children.", "Splash setting overrides via the API are not supported for template children.", "Availability settings overrides are not supported for template children."]}, @response=#<Net::HTTPBadRequest 400 Bad Request readbody=true>, @headers={"date"=>["Fri, 15 Dec 2023 19:58:43 GMT"], "content-type"=>["application/json; charset=utf-8"], "transfer-encoding"=>["chunked"], "connection"=>["close"], "x-frame-options"=>["sameorigin"], "x-xss-protection"=>["1; mode=block"], "x-content-type-options"=>["nosniff"], "x-robots-tag"=>["none"], "cache-control"=>["no-cache, no-store, max-age=0, must-revalidate"], "pragma"=>["no-cache"], "expires"=>["Fri, 01 Jan 1990 00:00:00 GMT"], "x-request-id"=>["8242ec5e8bae3de1928bfcf7bf3dfb73"], "x-runtime"=>["0.175757"], "strict-transport-security"=>["max-age=31536000; includeSubDomains"]}>
 
 
Also when I try to use this API endpoint: res = HTTParty.put(
follow_redirects: true,
headers: {"X-Cisco-Meraki-API-Key" => site.api_key},
query: {"splashUrl" => "https://meraki.yourhotspot.net/#{site.user_id}/login/#{site.location_id}", "useSplashUrl" => "true"}
)
RESPONSE: <HTTParty::Response:0x43117e0 parsed_response={"errors"=>["Error for /organizations/{organizationId}/configTemplates/{configTemplateId}: None of the fields ('name' or 'timeZone') were specified."]}, @response=#<Net::HTTPBadRequest 400 Bad Request readbody=true>, @headers={"date"=>["Fri, 15 Dec 2023 19:49:04 GMT"], "content-type"=>["application/json; charset=utf-8"], "transfer-encoding"=>["chunked"], "connection"=>["close"], "x-frame-options"=>["sameorigin"], "x-xss-protection"=>["1; mode=block"], "x-content-type-options"=>["nosniff"], "x-robots-tag"=>["none"], "cache-control"=>["no-cache, no-store, max-age=0, must-revalidate"], "pragma"=>["no-cache"], "expires"=>["Fri, 01 Jan 1990 00:00:00 GMT"], "x-request-id"=>["eaf195fd4bdf29df8fd301f07287da0d"], "x-runtime"=>["0.102529"], "strict-transport-security"=>["max-age=31536000; includeSubDomains"]}>
 
Any ideas how to do it ? or if there is something that we are missing.

Thank you.
1 Reply 1
PhilipDAth
Kind of a big deal
Kind of a big deal

>RESPONSE: #<HTTParty::Response:0x59c8fd8 parsed_response={"errors"=>["IP assignment mode setting overrides are not supported for template children.",

 

For the first one - if the network is bound to a template you can't apply this config to it.  You can only apply it to the template.  Once applied to the template the network will automatically inherit this config.

 

For the second one - what you need to be doing is doing what you are doing in the first example - updating an SSID - but using the network number of the template.

 

Here is an example of some code I used to get a network ID.  It first tries to find a network with the name, and failing that it then tries to find a template with the name.

 

# This function retrieves the netId
async def getNetId(dashboard,orgId,netName):
	netId=None

	# Search for the network
	for net in await dashboard.organizations.getOrganizationNetworks(orgId):
		if net['name'] == netName:
			netId=net['id']
			break;

	# If no network, search for a template
	if netId == None:
		for net in await dashboard.organizations.getOrganizationConfigTemplates(orgId):
			if net['name'] == netName:
				netId=net['id']
				break;

	# Nothing found matching at all
	if netId == None:
		print("Invalid network name supplied: "+netName)			
		exit(-1)

	return netId

 

 

Get notified when there are additional replies to this discussion.