02-20-2025 09:35 AM
I'm running into an issue trying to use the API to provision APs on version 2.3.7.7.
https://developer.cisco.com/docs/dna-center/2-3-7/ap-provision/
Per the documentation I need to send the below in the payload.
deviceName, SiteNameHierarchy, and type are required.
When I send that information to the API I get responses that other items are required.
2025-02-20 10:03:37,540 - classes.Logger - DEBUG - Status code 400, Request failed due to malformed request syntax: 3802-AP-1. The response text is {"response":{"errorCode":"NCWS14001","message":"Validation Errors in request payload.","errors":[{"errorCode":"NCWS14014","message":"Validation Errors in request payload.","detail":"Site ID is a mandatory parameter."},{"errorCode":"NCWS14008","message":"Validation Errors in request payload.","detail":"networkDevices is a mandatory parameter."}]},"version":"1.0"}
It's saying that Site ID and networkDevices are also mandatory. I added them into the payload and then it just says it's an invalid JSON.
2025-02-20 12:04:25,311 - classes.Logger - DEBUG - Status code 400, Request failed due to malformed request syntax: 3802-AP-1. The response text is {"response":{"errorCode":"NCWS70003","message":"Validation failed due to invalid request","detail":"Invalid JSON passed in the request body"},"version":"1.0"}
Has anyone else had success using the API to provision APs in version 2.3.7.7?
Solved! Go to Solution.
02-21-2025 02:35 PM
https://{server}/dna/intent/api/v1/wirelessAccessPoints/provision
{
"networkDevices": [
{
"deviceId": "string",
"meshRole": "string"
}
],
"rfProfileName": "string",
"apZoneName": "string",
"siteId": "string" (Need to provide floorId, AP get assigned)
}
Prerequisite: Access Point has to be assigned to the site before get provisioned using the below API
02-21-2025 12:12 AM
could you please share the API and parameters passed
02-21-2025 04:44 AM
I'm using a CSV file as input for the payload. Below is the API URL I'm connecting to.
url = f'https://{server}/dna/intent/api/v1/wirelessAccessPoints/provision'
headers = {'X-Auth-token': token_api, 'Content-Type': 'application/json'}
This is an line from my csv file.
deviceName | networkDevices | rfProfile | siteId | siteNameHierarchy | type | customApGroupName | customFlexGroupName |
3802-AP-1 | 3802-AP-1 | GAMP-001 | fc2e10fc-5ffe-45b3-af8e-50098c868c22 | Global/Site1/01 - Court | Unified AP |
This is how I'm building the payload.
payload = {
"rfProfile": str(row['rfProfile']),
"deviceName": str(row['deviceName']),
"customApGroupName": str(row['customApGroupName']),
"customFlexGroupName": [str(row['customFlexGroupName'])],
"type": str(row['type']),
"siteNameHierarchy": str(row['siteNameHierarchy']),
"siteId": (row['siteId']),
"networkDevices": str(row['networkDevices'])
}
02-21-2025 05:10 AM
There are additional items in here since I was trying to get this to work based upon the error messages.
02-21-2025 01:24 AM
Just off the doc, i see it says APProvisionRequest[] - so you need to pass an array here. Try a payloads like
[
{
"type": "ApWirelessConfiguration",
"deviceName": "3802-AP-1",
"siteNameHierarchy": "Global/...",
"rfProfile": "your-rf-profile",
"customApGroupName": "your-custom-group",
"customFlexGroupName": ["your-flex-group"]
}
]
02-21-2025 04:45 AM
Yes I do that. I even made sure in the array the types are set to ensure that wasn't the issue.
payload = {
"rfProfile": str(row['rfProfile']),
"deviceName": str(row['deviceName']),
"customApGroupName": str(row['customApGroupName']),
"customFlexGroupName": [str(row['customFlexGroupName'])],
"type": str(row['type']),
"siteNameHierarchy": str(row['siteNameHierarchy']),
"siteId": (row['siteId']),
"networkDevices": str(row['networkDevices'])
}
02-21-2025 07:07 AM
@shane.carnahan i am just taking a guess here, should NetworkDevices be also an array?
02-21-2025 08:13 AM
I just changed it and no good. Still says it's Invalid JSON.
payload = {
"rfProfile": str(row['rfProfile']),
"deviceName": str(row['deviceName']),
"customApGroupName": str(row['customApGroupName']),
"customFlexGroupName": [str(row['customFlexGroupName'])],
"type": str(row['type']),
"siteNameHierarchy": str(row['siteNameHierarchy']),
"siteId": (row['siteId']),
"networkDevices": [str(row['networkDevices'])]
}
02-21-2025 08:27 AM
Gahh... could you share what the json.dumps output shows here?
02-21-2025 08:37 AM
2025-02-21 11:36:52,212 - classes.Logger - DEBUG - Payload is {'rfProfile': 'GAMP-001', 'deviceName': '3802-AP-1', 'customApGroupName': '', 'customFlexGroupName': [''], 'type': 'Unified AP', 'siteNameHierarchy': 'Global/Site1/01 - Court', 'siteId': 'fc2e10fc-5ffe-45b3-af8e-50098c868c22', 'networkDevices': ['3802-AP-1']}
2025-02-21 11:36:52,229 - classes.Logger - DEBUG - Status code 400, Request failed due to malformed request syntax: 3802-AP-1. The response text is {"response":{"errorCode":"NCWS70003","message":"Validation failed due to invalid request","detail":"Invalid JSON passed in the request body"},"version":"1.0"}
2025-02-21 11:36:52,229 - classes.Logger - DEBUG - Payload is {'rfProfile': 'GAMP-002', 'deviceName': '3802-AP-2', 'customApGroupName': '', 'customFlexGroupName': [''], 'type': 'Unified AP', 'siteNameHierarchy': 'Global/Storrs/Gampel/01 - Court', 'siteId': 'fc2e10fc-5ffe-45b3-af8e-50098c868c22', 'networkDevices': ['3802-AP-2']}
2025-02-21 11:36:52,239 - classes.Logger - DEBUG - Status code 400, Request failed due to malformed request syntax: 3802-AP-2. The response text is {"response":{"errorCode":"NCWS70003","message":"Validation failed due to invalid request","detail":"Invalid JSON passed in the request body"},"version":"1.0"}
2025-02-21 11:36:52,239 - classes.Logger - DEBUG - Payload is {'rfProfile': 'GAMP-003', 'deviceName': 'C9120AXI-AP-3', 'customApGroupName': '', 'customFlexGroupName': [''], 'type': 'Unified AP', 'siteNameHierarchy': 'Global/Storrs/Gampel/01 - Court', 'siteId': 'fc2e10fc-5ffe-45b3-af8e-50098c868c22', 'networkDevices': ['C9120AXI-AP-3']}
2025-02-21 11:36:52,248 - classes.Logger - DEBUG - Status code 400, Request failed due to malformed request syntax: C9120AXI-AP-3. The response text is {"response":{"errorCode":"NCWS70003","message":"Validation failed due to invalid request","detail":"Invalid JSON passed in the request body"},"version":"1.0"}
2025-02-21 11:36:52,248 - classes.Logger - DEBUG - Payload is {'rfProfile': 'GAMP-004', 'deviceName': 'C9120AXI-AP-4', 'customApGroupName': '', 'customFlexGroupName': [''], 'type': 'Unified AP', 'siteNameHierarchy': 'Global/Storrs/Gampel/01 - Court', 'siteId': 'fc2e10fc-5ffe-45b3-af8e-50098c868c22', 'networkDevices': ['C9120AXI-AP-4']}
2025-02-21 11:36:52,257 - classes.Logger - DEBUG - Status code 400, Request failed due to malformed request syntax: C9120AXI-AP-4. The response text is {"response":{"errorCode":"NCWS70003","message":"Validation failed due to invalid request","detail":"Invalid JSON passed in the request body"},"version":"1.0"}
02-21-2025 08:43 AM
Just in case anyone is wondering I have used this method to do other things in the API. I can create, update, and delete RF Profiles via this same method for example. I just can't get the provisioning to work.
02-21-2025 10:48 AM
Excuse the formatting, I think the payload needs to be wrapped in the array
payload = [{ "rfProfile": str(row['rfProfile']), "deviceName": str(row['deviceName']),"customApGroupName": str(row['customApGroupName']), "customFlexGroupName":[str(row['customFlexGroupName'])], "type": str(row['type']), "siteNameHierarchy": str(row['siteNameHierarchy']),"siteId": row['siteId'], "networkDevices": [str(row['networkDevices'])] }]
also, not sure about the type, 'type' is set to "Unified AP" in your example payload, but the documentation mentions it should be "ApWirelessConfiguration"? I’m not really up to speed on this API, so could be a false flag
02-21-2025 02:35 PM
https://{server}/dna/intent/api/v1/wirelessAccessPoints/provision
{
"networkDevices": [
{
"deviceId": "string",
"meshRole": "string"
}
],
"rfProfileName": "string",
"apZoneName": "string",
"siteId": "string" (Need to provide floorId, AP get assigned)
}
Prerequisite: Access Point has to be assigned to the site before get provisioned using the below API
02-25-2025 05:58 AM
I was able to get AP provisioning working based upon your input. Thank you very much.
As a note to anyone that may come across this later this is what I had to do. As noted by vgulla@cisco.com, the AP must be assigned to the site before you can provision it. If it's not in the correct site you will get an error something like this, ""Site fc2e10fc-5ffe-45b3-af8e-50098c868c22 is not associated with APs"
{
"networkDevices": [
{
"deviceId": "string", <-- This is the UUID of the device you are trying to provision.
"meshRole": "string" <-- Not required but if it is present it cannot be blank, only accepts "Valid Roles : [MAP,RAP]"
}
],
"rfProfileName": "string",
"apZoneName": "string", <-- not required
"siteId": "string" (Need to provide floorId, AP get assigned) <-- This is the UUID of the site
}
API: /dna/intent/api/v1/networkDevices/assignToSite/apply.
{
"deviceIds": ["string"], <-- This is the UUID of the device you are trying to provision.
"siteId": "string" (Floor Id where the AP gets assigned eg: 'c2e10fc-5ffe-45b3-af8e-50098c868c22') <-- This is the UUID of the site
}
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide