Self-referencing REST API

2 posts / 0 new
Last post
Self-referencing REST API

I've always thought that REST APIs should include a standard call that returns a definitive list of all currently supported calls. That way one can write consuming software that is self-updating and self documenting.

I've pulled all the calls from the IG Labs web site. Just the call strings for now, though the table also has methods, versions and description fields that could just as easily be pulled.

This is a brittle approach though. I would like to suggest that IG include a call that returns some well formatted json output that is a stable and definitive representation of the current API.

Below is some short Matlab code that does an OK job.

% Get the list of queries from the API documentation
str = urlread('');
pat = '<a href="/rest-trading-api-reference/service-detail\?id=\d*">([^<])*';
qcell = regexp(str,pat,'tokens');
% Some Matlab conversion stuff that makes the whole thing look obtuse.
for i = 1:numel(qcell), qstr(i) = qcell{i}; end


ans =


Self-referencing REST API

Hi Neilcaithness,

Thanks for posting this, it's very useful. We've also added this to our list of potential future developments as well!


Log in or register to post comments