cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1070
Views
1
Helpful
13
Replies

Catalyst Center 2.3.7 API for AP Provision Issue

shane.carnahan
Level 1
Level 1

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.

  • customApGroupName:string Custom AP group name
  • deviceName*:string Device name
  • rfProfile*:string Radio frequency profile name
  • siteNameHierarchy*:string Site name hierarchy(ex: Global/...)
  • type*:string ApWirelessConfiguration
  • customFlexGroupName:string[] ["Custom flex group name"]

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?

 

 

1 Accepted Solution

Accepted Solutions

vgulla@cisco.com
Cisco Employee
Cisco Employee
This API is used to provision Access Points

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

API: /dna/intent/api/v1/networkDevices/assignToSite/apply.
{
"deviceIds": [
"string"
],
"siteId": "string" (Floor Id where the AP gets assigned eg: 'c2e10fc-5ffe-45b3-af8e-50098c868c22')
}
 
Provide the deviceId instead of device name in the AP provisioning API

View solution in original post

13 Replies 13

vgulla@cisco.com
Cisco Employee
Cisco Employee

could you please share the API and parameters passed

 

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'])
}

There are additional items in here since I was trying to get this to work based upon the error messages.

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"]
    }
]
The error messages you're getting about siteId and networkDevices being mandatory seem to contradict the API documentation.
Please mark this as helpful or solution accepted to help others
Connect with me https://bigevilbeard.github.io

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'])
}

@shane.carnahan i am just taking a guess here, should NetworkDevices be also an array?

Please mark this as helpful or solution accepted to help others
Connect with me https://bigevilbeard.github.io

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'])]
}

Gahh... could you share what the json.dumps output shows here?

Please mark this as helpful or solution accepted to help others
Connect with me https://bigevilbeard.github.io

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"}

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.

 

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

Please mark this as helpful or solution accepted to help others
Connect with me https://bigevilbeard.github.io

vgulla@cisco.com
Cisco Employee
Cisco Employee
This API is used to provision Access Points

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

API: /dna/intent/api/v1/networkDevices/assignToSite/apply.
{
"deviceIds": [
"string"
],
"siteId": "string" (Floor Id where the AP gets assigned eg: 'c2e10fc-5ffe-45b3-af8e-50098c868c22')
}
 
Provide the deviceId instead of device name in the AP provisioning API

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
}

Review Cisco Networking for a $25 gift card