How send/format TableRequestInfo with json from python?

I try to get a datatable from a .net server. However, my attemps always send TableRequestInfo as empty, This is what the call look like form python:

send: 'POST /json HTTP/1.0\r\nHost: intersec.local:8099\r\nUser-Agent: jsonlib.py/0.0.1 (by matt harrison)\r\nContent-Type: application/json\r\nContent-Length: 239\r\n\r\n’
send: '{“params”: [[“filter_product_by_category”], ["", true, -1, [[“category”, “ABARROTES”], [“order_by_option”, “alphabetic”], [“page_number”, 1], [“paginate_by”, 20]]]], “method”: “Data.getData”, “id”: “{fa443e16-06ee-4d0e-a44f-382f44e170ec}”}'
reply: 'HTTP/1.1 200 OK\r\n’
header: Server: BestSeller HTTP/1.0
header: Connection: Close
header: Content-Length: 1023
header: Content-Type: application/Json

What is the correct format for the json post?

Hello!

Just passing by… Here’s an example of JSON data that JavaScript client sends:

{"id":"{bfe178db-e613-4c4c-a192-c7c5ed9557fe}","method":"DASampleService.GetData","params":{"aTableNameArray":["workers"],"aTableRequestInfoArray":[{"IncludeSchema":true,"MaxRecords":-1,"Parameters":[],"UserFilter":""}]}}

Ok, thanks, but how must look paramets?

Parameter is an object that has Name and Value properties. So something like this:
“Parameters”:[{“Name”:“p_1”,“Value”:999}, {“Name”:“p_2”,“Value”:“somestring”}]

I having problems with this.

I’m using https://gist.github.com/1886919 to make the calls, but the formating can’t match the ones from the JS library.

It has to follow conventions used by JsonMessage, otherwise the server couldn’t deserialize request properly. The easiest way to quickly find out what exactly you need to pass in different situations is to add some logging at server side and make requests with .net client.

I’ve taken a look at that library. Although I don’t know python it seems possible to build params object that would be serialized properly. Here’s my attempt at

saving code here, don’t know how long that link would last

import json as simplejson
request = {}
params = {}
tri = {}
tri["InclueSchema"] = "true"
tri["UserFilter"] = ""
tri["MaxRecords"] = -1
tri["Parameters"] = [{"Name":"p_1", "Value":999}]
request["id"] = "xxx";
request["method"] = "Some.Method";
params["aTableNameArray"] = ["workers"];
params["aTableRequestInfoArray"] = [tri];
request["params"] = params;
print simplejson.dumps(request);