API PATCH with JQuery Ajax: error 422 with integers (SOLVED)

Topic Labels: API
3490 1
Showing results for 
Search instead for 
Did you mean: 
5 - Automation Enthusiast
5 - Automation Enthusiast


I can’t undestand this error. Here is my code using JQuery and Ajax:

    x = 1;
          url: "",
          type: 'PATCH',
          dataType: "json",
          data: {
            "fields" : {
              "FIELD": VALUE

When I replace FIELD with the proper field name, and the data type of that field is a string, and replace VALUE with a string (e.g., “hola”), I can update the field through the API. But when replace FIELD with the proper name of an integer field, and replace VALUE whit a number (e.g., 1234), I get this error:

PATCH 422 (Unprocessable Entity)

I tried a lot of things but nothing works.

Anyone can help me?


1 Reply 1

Nadie apareció, pero logré resolverlo solo. Me faltaba poner el parámetro

contentType : "application/json",

Y en caso de que el valor se pase a través de un textfield, hay que encerrar la variable en un parseINT(), así: