Dynamic Object Import Using REST

2
Hi all, We are doing a REST call to Binance’s APIs. For the ExchangeInfo endpoint, we receive different formats for the different filters. For example: { "filters": [ { "filterType": "PRICE_FILTER", "minPrice": "0.00100000", "maxPrice": "10000.00000000", "tickSize": "0.00100000" }, { "filterType": "LOT_SIZE", "minQty": "0.10000000", "maxQty": "90000.00000000", "stepSize": "0.10000000" } ] } If trying to use a JSON structure, the JSON structure gives an error for the inconsistancy in the structure and a message definition does not want to import. How can we define this structure for the import?
asked
1 answers
1

Hi Nico,

 

You need to add all your possible filter attribute into in the JSON to a single object like this:

{
	"filters": [
		{
			"filterType": "PRICE_FILTER",
			"minPrice": "0.00100000",
			"maxPrice": "10000.00000000",
			"tickSize": "0.00100000",
			"minQty": "0.10000000",
			"maxQty": "90000.00000000",
			"stepSize": "0.10000000"
		}
	]
}

 

That allows you to map the attributes into a single filter object even if the return only contains three attributes. You import mapping should look like this:

 

Hope this helps.

 

answered