Hello!
I need to update a field using jQuery and the API once the user clicks a link.
If I'm not wrong, I need a PUT request.
The user ID is 55ad2633a4520e471178f803, so I tried the following:
// PUT
$('.button').click(function(event) {
var data = {
field_41: ["55a1b550b2847881712431fe"]
}
$.ajax( {
// im almost sure my error comes from the url
url: 'https://api.knackhq.com/v1/objects/object_6/records/55ad2633a4520e471178f803',
type: "PUT",
headers: {
"Content-Type":"application/json",
"X-Knack-Application-Id": "556de6547d722ec119a0b534",
"X-Knack-REST-API-Key":"c4c7f280-2652-11e5-9561-4d1eb45b6890"
},
data: data,
success: function(response) {
alert('Record Added!');
}
});
}); In the Console, the error returned is:
// [Error] Failed to load resource: the server responded with a status of 400 (Bad Request) https://api.knackhq.com/v1/objects/object_6/records/55ad2633a4520e471178f803
How is my URL supposed to be formated?