Pushbullet APIPushbullets API enables developers to build on the Pushbullet infrastructure. Our goal is to provide a full API that enables anything to tap into the Pushbullet network. This is important to us because we believe everything, not just smartphones and computers, should be able to exchange information in real time. Here are some of the things you can build with Pushbullet Have a website and want to offer push notificationsMethod authentication POST requests apiid only standard apiid authentication required, because we are creating a request that the user already has access to. If such a URL is entered into the browser address bar, then you should see an XML response like this youll find some interesting properties, like those Ive. I think that you could use a POST or PATCH method to handle this since they typically design for this. Using a POST method is typically used to add an element when. Last modified September 21st, 2017. Getting started. Cloudflares API exposes the entire Cloudflare infrastructure via a standardized programmatic interface. Weve built everything you need. Want to build a Pushbullet client for a platform we dont officially support yet Everything you need is here. Working on a home automation system Pushbullet can get everything chatting. Working with sensors and want to send messages to another devicePushbullet is just what you need. Manage ITservers and want to get updates and alerts no matter where you are or what device youre usingPushbullet makes it easy. API Sendreceive pushes using the Pushbullet server. For everything else including incorrect things or suggested changes to these docs feel free to contact us at email protected. All of our examples use the curl command line tool already available on most systems. If you use Mac, it should already be installed, just open the Terminal app and run it. If you are using Linux, it should already be installed, just open the Console and run it. On Windows youre going to have to download it here or from the curl download page. The Pushbullet API lets you sendreceive pushes and do everything else the official Pushbullet clients can do. To access the API youll need an access token so the server knows who you are. You can get one from your Account Settings page. Once you have that access token, you can use it to access your Pushbullet account using the Pushbullet API Example Get Current User Requestcurl header Access Token lt youraccesstokenhere. Responsecreated 1. Elon MuskThe API accepts requests over HTTPS at https api. All POST requests must use a JSON body with the Content Type header set to applicationjson. Most programming languages have some way to encoded objects to JSON, and using the built in library is recommended, since it will correctly handle newline characters and quotes. To authenticate for the API, use your access token in a header like Access Token lt youraccesstokenhere. Your access token can be found on the Account Settings page. Keep in mind that this key has full access to your account, so dont go posting it all over the internets. If you are making an app that uses the Pushbullet API on behalf of another user for instance, to send push notifications as that user, use OAuth to get an access token for that user. Using your own access token while developing though saves you from having to setup OAuth until later. You can make a request from any app, though how you do that may depend on if you are writing a script or using a programming language. If you have a terminal and the curl utility you can perform requests from the command line. Example Get Current User Requestcurl header Access Token lt youraccesstokenhere. Responsecreated 1. Elon MuskBecause we allow CORS requests, you can make a request from any browser you can hit the run button or copy and paste this code into your javascript console Responses are always JSON. Keys are either present with a non empty value, or entirely absent from the response. Empty values are null, false, and. Deleted objects will only have the keys iden, active, created, and modified because all other properties have been removed and are now empty values. created 1. Ao. Rtn. M0jc,modified 1. OK Everything worked as expected. Bad Request Usually this results from missing a required parameter. Unauthorized No valid access token provided. Forbidden The access token is not valid for that request. Not Found The requested item doesnt exist. Too Many Requests You have been ratelimited for making too many requests to the server. XX Server Error Something went wrong on Pushbullets side. If this error is from an intermediate server, it may not be valid JSON. Error responses any non 2. The response JSON will have an error property with the following fields type A machine readable code to refer to this type of error. Either invalidrequest for client side errors or server for server side errors. A mostly human readable error message. OPTIONAL Appears sometimes during an invalidrequest error to say which parameter in the request caused the error. Some sort of ASCII cat to offset the pain of receiving an error message. error cat ,message The resource could not be found. ,type invalidrequestErrors from the Pushbullet server will have this JSON body. Errors from intermediate servers or the hosting infrastructure may not, so you should be able to handle a non JSON response as a generic error. Objects such as pushes and devices can be created, modified, listed and deleted. All timestamps that appear on objects are floating point seconds since the epoch, also called Unix Time. All calls to list objects list accept the active, limit, and cursor parameters. By default, listing objects of any type will return deleted objects this is useful for syncing. When you are getting the initial list of objects, you may want to only fetch the active ones. To get only active objects, set active to true on the request. When listing objects, if you receive a cursor in the response, it means the results are on multiple pages. To request the next page of results, use this cursor as the parameter cursor in the next request. Any time you list a collection of objects, they may be multiple pages objects are always returned with the most recent ones first. You can specify a limit parameter on any calls that return a list of objects to get a smaller number of objects on each page. The default maximum limit is 5. All calls to list objects accept a modifiedafter property a timestamp. Any objects modified since that time will be returned, most recently modified first. The modifiedafter parameter should be the most recent modified value from an object returned by the server dont trust the local machines timestamp as it usually is not the same value as the server. When you query with a modifiedafter timestamp to sync changed objects to a device, you need to know if an object was deleted so you can remove it locally. Deleted objects will have activefalse and all properties except for iden, created, modified, and active will be missing from the returned object. Deleted objects show up by default when listing objects. Pushes have an imageurl property that can be resized by setting query parameters. To use this, add slt pixels to the end of the url. Resize the image so that the longest side is not longer than 1. Before. After. The imageurl should be hosted on domain ending with. If the domain does not end with that, you should not attempt to resize the image with a query parameter. Objects besides pushes have an imageurl property but they cannot necessarily be resized the same way. We try to make only backwards compatible changes to existing public API calls. This means that we should not change the meaning of existing calls, and that we will only add, not remove, keys from objects returned from the API. Adding a key is considered to be a backwards compatible change. When you do a request to the API you will receive headers like the following on the response X Ratelimit Limit 3. X Ratelimit Remaining 3. X Ratelimit Reset 1. These tell you what the ratelimit is, how much you have remaining and when it resets integer seconds in Unix Time. The units are a sort of generic cost number. A request costs 1 and a database operation costs 4. So reading 5. 00 pushes costs about 5. You can see how much a request cost by the change in X Ratelimit Remaining between two requests. Free accounts without a Pro subscription are limited to 5. Going over will result in an error when sending a Push. OAuth lets you access a users Pushbullet account or have them authenticate with their Pushbullet account using a browser. OAuth is a standard authentication procedure used by most websites, heres how it works. You, the app developer, register your app called an OAuth client with Pushbullet. Using a url you generate in your app you can see an example one on the Create Client page you send the user to the Pushbullet site.
|
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
October 2017
Categories |