Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Having an issue with REST API Explorer using PATCH method on CMDB Instance API

Jay Jav
Tera Contributor

Hi,

I am trying to test and use the CMDB Instance API, but I faced an issue with PATH Method.

In REST API Explorer,when I want to change the value of "ram" for any class and specific CI using the SYS ID, I receive the 500 Internal Error message. I tested with PDI and other instances and the issue persists.

it says the attributes is null, how can I address the issue in the REST API explorer?

 

 

{
"error": {
"message": "Exception while executing request: Cannot invoke \"java.util.Map.put(Object, Object)\" because \"attributes\" is null",
"detail": "Cannot invoke \"java.util.Map.put(Object, Object)\" because \"attributes\" is null Check logs for error trace or enable glide.rest.debug property to verify REST request processing"
},
"status": "failure"
}

 

 

 

14 REPLIES 14

Bhuvan
Giga Patron

@Jay Jav 

 

Take for example below CI

Bhuvan_0-1758331367267.png

If you want to update RAM using PATCH method, pass the payload as below

 

https://<instance>.service-now.com/api/now/table/<ci_class>/<sys_id>

Bhuvan_2-1758332177729.png

Payload

{
      "ram": "2048"
}

Bhuvan_1-1758331990826.png

Bhuvan_3-1758332215489.png

If you want to pass multiple attributes, logic is same

Bhuvan_4-1758332416586.png

Bhuvan_5-1758332433578.png

I hope you appreciate the efforts to provide you with detailed information. As per community guidelines, you can accept more than one answer as accepted solution. If my response helped to answer your query, please mark it helpful & accept the solution.

 

Thanks,

Bhuvan

@Jay Jav 

 

Did you get a chance to review this as I believe the information provided should answer your question.

 

If my response helped to guide you or answer your query, please mark it helpful & accept the solution.

 

Thanks,

Bhuvan

Javad
Tera Contributor

Hi @Bhuvan ,

as I mentioned in my  question, I wantted to use CMDB Instance API, instead of Table API

I did not have an issue with Table API, PATCH method; my challenge was the CMDB Instance API.

Thank you anyway for providing information. much appreciate it.

@Javad @Jay Jav 

 

Try below for CMDB Instance API

Bhuvan_0-1758548985847.png

Bhuvan_1-1758549001107.png

For multiple attributes update,

Bhuvan_2-1758549101550.pngBhuvan_3-1758549119528.png

https://www.servicenow.com/docs/bundle/zurich-api-reference/page/integrate/inbound-rest/concept/cmdb...

 

I hope you appreciate the efforts to provide you with detailed information. If my response helped to guide you or answer your query, please mark it helpful & accept the solution.

 

Thanks,

Bhuvan

@Jay Jav @Javad 

 

Thanks for marking the post as helpful.

 

As per community guidelines, you can accept more than one answer as accepted solution. If my response helped to guide you or answer your query, please mark it helpful & accept the solution.

 

Thanks,

Bhuvan