cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
2361
Views
0
Helpful
6
Replies

500 errors on PUT with API

earl.lewis1
Level 1
Level 1

I'm trying to run the a PUT operation via the API, updating name and mapLocation, and not having any joy. I'm using Postman to submit the requests and followed the instructions noted here Using self-signed SSL certificates with Postman – Postman Blog   to ensure that our self-signed certificate is accepted.

Here are the details:

URL for my request is:

https://ciscoprime.domain/webacs/api/v1/op/apService/accessPoint.json 

The request payload is as follows, where accessPointId has been selected from a previous GET operation:

  "accessPoint" : { 

    "accessPointId" : 12860886, 

    "mapLocation" : "New Location Name", 

    "name" : "ap-new-name-test" 

  } 

The response I'm getting is:

  "errorDocument": { 

    "httpResponseCode": 500, 

    "httpMethod": "PUT", 

    "message": "java.lang.NullPointerException", 

    "exception": "javax.ws.rs.WebApplicationException: java.lang.NullPointerException", 

    "uriPath": "op/apService/accessPoint", 

    "queryParams": "{}" 

  } 

I have basic auth credentials setup in the header of the request, which works fine for GETs. I've been granted NBIWrite permissions by the system admin.

Any ideas why I'd be getting a 500 error? BTW, I can do GET requests all day long and they work just fine. Also, when I was running these prior to getting my NBIWrite permission setup I was getting permissions errors, so I'm assuming my permissions are now setup correctly.

1 Accepted Solution

Accepted Solutions

Spencer Zier
Cisco Employee
Cisco Employee

When using the v1/op/apService/accessPoint service, you need to specify all of the parameters in the request payload.  The NullPointerException is due to the service trying to find information in the request that hasn't been specified, and is therefore null.

View solution in original post

6 Replies 6

Spencer Zier
Cisco Employee
Cisco Employee

When using the v1/op/apService/accessPoint service, you need to specify all of the parameters in the request payload.  The NullPointerException is due to the service trying to find information in the request that hasn't been specified, and is therefore null.

Your answer is helpful, so thank you very much. However, the API documentation leaves a lot to be desired. And to say that "you need to specify all the parameters" is even a little deceiving. What, exactly, constitutes "all the parameters"? Is it all the parameters that are specified in the documentation for that API endpoint? I assumed that's what it meant, and that seemed to do the trick. Anyway, hopefully you understand what I mean about the documentation not being very good. Thanks again. 

Yeah, I agree, we need to do better here.  Does the documentation for some of the WLAN Provisioning resources meet your expectations?  If not, do you have suggestions for what we could do to make it better?

For the request parameters, I'd prefer to see a separate column that says what's required vs. optional. Even on the example you pointed me to only the ones that are optional say so. I'm assuming the rest are required? I don't know. If a parameter is required why would you be silent on that fact? Especially for API documentation I think this is a requirement to ensure that someone can pick it up quickly and get it working fast. Thanks again for your response and question.

I've had the same thought myself that Earl is articulating here. There are places where it would be helpful for the documentation to call out required versus optional parameters. This is an excellent suggestion.

timway001
Level 1
Level 1

You may find this reply relevant on how to use this particular AP call a little better.

Re: Experiencing Constraints with apService/accessPoint