This post provides a simple example of how a Dynamics 365 C# plugin can connect to an external REST API (i.e. sitting outside of the Dynamics 365 environment). (The class used to achieve this being the RestClient class.)
The Code
Based on my experience, it seems calling a REST API from a plugin can be a bit challenging. This might be based on security issues or the way Dynamics handles asynchronous code. Anyway, the code sample below works.

It represents a simple ‘action’ which was registered as ‘None’

and ‘PostOperation’

and tested with the CRM REST Builder tool
Further reading
Download leads from the facebook api