Skip to content

Instantly share code, notes, and snippets.

@karanrajs
Created May 28, 2016 05:53
Show Gist options
  • Save karanrajs/f96c023ccf362e39fff3f410424d2575 to your computer and use it in GitHub Desktop.
Save karanrajs/f96c023ccf362e39fff3f410424d2575 to your computer and use it in GitHub Desktop.
String Id = '<Your-Device Id>';
String endpoint = '<Your-public webservice URL>';
String littleBitEvent = 'amplitude:delta:ignite';
String accessToken = '<Device AccessToken>';
Http h = new Http();
HttpRequest req = new HttpRequest();
req.setMethod('POST');
req.setEndpoint('https://api-http.littlebitscloud.cc/subscriptions');
req.setHeader('Authorization','Bearer ' + accessToken);
req.setHeader('Accept', 'application/vnd.littlebits.v2+json');
req.setBody('publisher_id=' + Id + '&subscriber_id=' + endpoint);
HttpResponse response = h.send(req);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment