Json data is not rendering throws invalid json
Here is the json data i am getting
{"message":"Success","responseCode":200,"status":true,"data":[{"MeterNumber":"020920231","MeterMake":"ALLIED-TP","MeterType":"CT","id":"1e0065c5-afd0-4721-bf28-44481ce888ca","MeterInterface":"RS232"},{"MeterNumber":"020923","MeterMake":"ALLIED-TP","MeterType":"CT","id":"99b4805f-000c-4970-87e0-539e239c58f0","MeterInterface":"RS232"},{"MeterNumber":"0209202302233334","MeterMake":"ALLIED-TP","MeterType":"CT","id":"cebe67ef-b903-488b-ad91-2c61876fa3fa","MeterInterface":"RS232"},{"MeterNumber":"02092023022333","MeterMake":"ALLIED-TP","MeterType":"CT","id":"04bfb423-46ac-4f0f-ab4c-d3c39fe1ca2e","MeterInterface":"RS232"},{"MeterNumber":"020920230223333","MeterMake":"ALLIED-TP","MeterType":"CT","id":"09be20ba-69cb-4338-a01d-2580d571afb9","MeterInterface":"RS232"}],"draw":1,"recordsTotal":83726,"recordsFiltered":83726}
What is issue how to render this into table what is the mistake i am doing
Even after sending all the parameters which serverside is expected then also it is not rendering
Below is the UI part
Related
I've been trying to try to do this for a couple of days for now. I am trying to update the user's data through put method in Django using rest framework. However, I've been receiving this error message in the console.
This is the fetch function that is used to send the data to the backend. As it's shown, I'm even trying to compare it to other fetch methods and I think nothing is wrong with the body of the fetch.
Below are my codes used to update the data.
views.py
serializers.py
urls.py
So, the error is
Unexpected token < in JSON
which means that it tried to parse a response containing a character <. If I had to guess, the response is a HTML document, because it would start with < (<html>...).
For instance, it can be a 404 error page because the URL was not found. The best way to know is, instead of logging response.json(), just log response.text(). Until you do that, hard to know what really happens.
I want to expose an endpoint in Business Central which can receive HTTP POST/PUT request and save content of that request into Blob, without any validation. I need that so I can receive json or xml data from external custom services.
I'm not sure how to achieve that since both OData and SOAP expect data to be in specific format and trigger data validation before I can even access POST-ed data.
I've been trying to play with Bound/Unbound actions but still can't figure out a way to access the content of the request. WebServiceActionContext is not well documented and I have not idea what I can or can't do with it. More about that: Microsoft documentation, Tutorial.
Any idea how to read content of a HTTP POST/PUT request is appreciated!
You could create a codeunit with a global procedure and then publish that as your web service.
Something like this:
codeunit 50000 MyUnstructuredWebService
{
procedure PostUnstructuredData(RequestId: Text; RequestContent: BigText);
begin
end;
}
Then you can handle the data directly or save it to a BLOB field in a table for later use.
The trick is to use BigText as the datatype for the parameter containing your actual content.
I am using DRF to serialize a model, and serve the model to an endpoint. I am using django-rest-framework-datatables to format that endpoint into the JSON DataTables requires with ?format=datatables. I have a large DataTable that I am trying to render, and once I get to a certain number of columns, a nondescript 404 error occurs (https://datatables.net/manual/tech-notes/7). The request URL for the ajax data is 2k+ characters long, and I think this is the issue since it's a GET request.
My query string looks like this:
format=datatables&draw=1&columns%5B0%5D%5Bdata%5D=id&columns%5B0%5D%5Bname%5D=&columns%5B0%5D%5Bsearchable%5D=true&columns%5B0%5D%5Borderable%5D=true&columns%5B0%5D%5Bsearch%5D%5Bvalue%5D=&columns%5B0%5D%5Bsearch%5D%5Bregex%5D=false&columns%5B1%5D%5Bdata%5D=triggerDate&columns%5B1%5D%5Bname%5D=&columns%5B1%5D%5Bsearchable%5D=true&columns%5B1%5D%5Borderable%5D=true&columns%5B1%5D%5Bsearch%5D%5Bvalue%5D=&columns%5B1%5D%5Bsearch%5D%5Bregex%5D=false&columns%5B2%5D%5Bdata%5D=entities&columns%5B2%5D%5Bname%5D=entities.entityDescription&columns%5B2%5D%5Bsearchable%5D=true&columns%5B2%5D%5Borderable%5D=true&columns%5B2%5D%5Bsearch%5D%5Bvalue%5D=&columns%5B2%5D%5Bsearch%5D%5Bregex%5D=false&columns%5B3%5D%5Bdata%5D=analyticCategory&columns%5B3%5D%5Bname%5D=analyticCategory.analyticCategory&columns%5B3%5D%5Bsearchable%5D=true&columns%5B3%5D%5Borderable%5D=true&columns%5B3%5D%5Bsearch%5D%5Bvalue%5D=&columns%5B3%5D%5Bsearch%5D%5Bregex%5D=false&columns%5B4%5D%5Bdata%5D=analytic&columns%5B4%5D%5Bname%5D=analytic.analyticDescription&columns%5B4%5D%5Bsearchable%5D=true&columns%5B4%5D%5Borderable%5D=true&columns%5B4%5D%5Bsearch%5D%5Bvalue%5D=&columns%5B4%5D%5Bsearch%5D%5Bregex%5D=false&columns%5B5%5D%5Bdata%5D=risk&columns%5B5%5D%5Bname%5D=risk.risk&columns%5B5%5D%5Bsearchable%5D=true&columns%5B5%5D%5Borderable%5D=true&columns%5B5%5D%5Bsearch%5D%5Bvalue%5D=&columns%5B5%5D%5Bsearch%5D%5Bregex%5D=false&columns%5B6%5D%5Bdata%5D=logic&columns%5B6%5D%5Bname%5D=logic.logic&columns%5B6%5D%5Bsearchable%5D=true&columns%5B6%5D%5Borderable%5D=true&columns%5B6%5D%5Bsearch%5D%5Bvalue%5D=&columns%5B6%5D%5Bsearch%5D%5Bregex%5D=false&columns%5B7%5D%5Bdata%5D=description&columns%5B7%5D%5Bname%5D=&columns%5B7%5D%5Bsearchable%5D=true&columns%5B7%5D%5Borderable%5D=true&columns%5B7%5D%5Bsearch%5D%5Bvalue%5D=&columns%5B7%5D%5Bsearch%5D%5Bregex%5D=false&columns%5B8%5D%5Bdata%5D=disposition&columns%5B8%5D%5Bname%5D=&columns%5B8%5D%5Bsearchable%5D=true&columns%5B8%5D%5Borderable%5D=true&columns%5B8%5D%5Bsearch%5D%5Bvalue%5D=&columns%5B8%5D%5Bsearch%5D%5Bregex%5D=false&order%5B0%5D%5Bcolumn%5D=0&order%5B0%5D%5Bdir%5D=asc&start=0&length=10&search%5Bvalue%5D=&search%5Bregex%5D=false&_=1554909043682
If I remove one column (any column), it works perfectly.
How do I get around this limitation without using POST since it's a REST API?
Our old legacy APIs accept the data only in form-data format, but I am required to send my data as JSON in body of request. So, how I can convert my JSON (application/json) input to form data in AWS Application gateaway.
I have input parameter like this
{"key1": "val1", "key2": "val2"}
I tried many solution with template mapping and query string parameter but they didn't work for me maybe I am doing something wrong. Above configuration is fully supporting form-data.
Note: Due to some reason I don't want to change my legacy django code to handle JSON input instead of form data.
I would suggest looking at the structure of a raw POST form-data request. Then you should be able to structure the Integration Request to fit the form-data format using the right Content-Type and mapping template.
There is an example for GET and an example for POST on this page (with the caption "the HTTP request looks like this") https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/Forms/Sending_and_retrieving_form_data
I'm trying to test a REST request using tastypie ResourceTestCase and api_client,
but it has a different behaviour from using angular js, for example.
The data sent for a DELETE request comes in GET parameters of the request using the api_client, but when I use angular it comes from raw POST data, how can I change the behaviour of Tastypie to acts like I expect? that is sending the data in the raw post data?
The current code:
response = self.api_client.delete(url,
format='json',
authentication=self.credentials,
data=data)