@tomtjes’ pointers are the right direction, generally. Drafts can make HTTP requests with it’s scripting interface. Do you have experience scripting access to APIs in general? The HTTP object works nicely with JSON-based APIs, and will even parse the result for you.
As far as the integration on Drafts’ end, the editor object (docs) has methods to get the selected text to pass to the API call, and to update it once you have received and parsed a result.