API call returning 400 bad request.

GopikaP
Mega Sage

Hi everyone, I am getting 400 Bad request while adding one more field as parameter in the request body. If I remove that specific field from the request body, the record will get inserted. That field is a custom field (is a string field) in incident table, and it is configured as read-only from dictionary. 

This is the error I am getting - 

 

{
  "error": {
    "message": "Error",
    "detail": "Wrong parameters: 'u_variable_name'. Allowed parameters are: additional_comments,assigned_to,assignment_group,business_service,caller,category,company,cmdb_ci,description,priority,short_description,state,ticket_type,work_notes,sub_category,correlation_id,correlation_display,impact,urgency"
  },
  "status": "failure"
}

 

 Thanks

2 ACCEPTED SOLUTIONS

@GopikaP 

 

I’m wondering how you're passing this in the API. It seems like there might be a syntax issue, or is this variable mapped in another instance?

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************

View solution in original post

Ankur Bawiskar
Tera Patron
Tera Patron

@GopikaP 

field is read-only at dictionary level -> Still you should be able to set value to it via API

what API is that? Table API or Scripted REST API

Any before insert/update business rule is stopping?

please share the field configuration screenshot here and how are you consuming that endpoint?

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

View solution in original post

10 REPLIES 10

Dr Atul G- LNG
Tera Patron
Tera Patron

Hi @GopikaP 

This can be considered as read-only, and you're calling it at the form level via the API. Please check the syntax carefully when adding it to the API call.

 

Is it get or post  call?

 

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************

Hi @Dr Atul G- LNG , it is a post call. So, is it because it is read-only?

Hi @GopikaP 

 

Is any of these are read only

 

additional_comments,assigned_to,assignment_group,business_service,caller,category,company,cmdb_ci,description,priority,short_description,state,ticket_type,work_notes,sub_category,correlation_id,correlation_display,impact,urgency"

 , if no, then i think its read only issue. 

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************

Hi @Dr Atul G- LNG ,Thanks for looking into this. I tried with one another custom read only field - it is not returning any error. So, I think it is not because of read-only.