The typical API request looks like this:
https://api.twelvedata.com/time_series?symbol=MMM&interval=1day&apikey=
For most cases, this is a great option; however, for some occasions, it might be more efficient to request multiple symbols, multiple endpoints, or several technical indicators at once. There are two main approaches to achieving these.
Batch request
This type of request works best when multiple symbols have to be requested from the same endpoint. The advantages include a faster response (rather than individually), saved traffic, and easier error handling. Each symbol has to be separated by a comma, and a colon might be used if the exchange has to be specified.
https://api.twelvedata.com/time_series?symbol=MMM,SBIN:NSE,EUR/USD&interval=1day&apikey=
This method could be used with /time_series
, /quote,
/price
, /exchange_rate
, /currency_conversion
, /eod
, and some other endpoints. Take note that each symbol passed still has the same API weight. So, in the example above, the request will consume 3 API credits.
Complex request
This is a big brother of batch requests that allows to construct and get data from API with any complexity. The data might be only received via a POST request, which provides flexibility to call multiple symbols, intervals, and endpoints simultaneously. More details, parameters, and examples can be encountered in the docs.