javascript - REST Api returning XML rather than JSON -
javascript - REST Api returning XML rather than JSON -
i trying create rest phone call via ajax jquery function. requesting results returned via json format. instead, beingness returned via xml, , unsure why. code issue? else can impact json requests? note: site https site if makes difference.
$.ajax( { type: 'get', url: "/sites/****/_api/web/lists/getbytitle('imagelist')/items", headers: { "accept": "application/json; odata=verbose" }, datatype: "json", contenttype: 'application/json; odata=verbose', success: function (data) { //do things }, error: function (xmlhttprequest, textstatus, errorthrown) { //do other things } });
unless endpoint specified return json, won't. endpoint utilizing returning xml because particular url designed send back. code correct, api @ url you're connecting sending content url supposed to.
your content-type
doesn't mean return json, states this type should expect.
since can't validate or test info really, should at:
endpoint - info should homecoming (url). is documentation on api accurate, using proper url? javascript jquery rest
Comments
Post a Comment