Hi- I’m a relative newbie to Smart app coding and Groovy.
I would like to make an HTTP post to the Pushbullet API, which requires your API key as a password.
I have tried this:
def pbNote = [
PASSWORD: “$pbKey”,
uri: “https://api.pushbullet.com ”,
path: “/v2/pushes”,
body: [“type”:“note”, “title”:“Garage Warning”, “body”:“$msg”]
]
httpPost(pbNote)
But I get an “Unauthorized” exception.
Any ideas? I don’t need to see the response, I’m not going to bother handling an error (though, I would prefer than an exception doesn’t crash the program, and it just tries again).
thanks
Have you seen this thread? The code is all there to do notifications via pushbullet
Now that Pushbullet is available for iOS, I thought it would be a good way to push messages to a single device since the ST app can’t currently do that and the text option is sometimes unreliable. Using @625alex ’s Pushbullet Device, I created Pushbullet Notifier.
5 Steps to Setup:
1. Go to https://www.pushbullet.com/ and sign up for an account. Also install Pushbullet on the device you want to receive notifications on.
2. Head to the IDE and in My Device Types install the device type below:
https://github.com/625alex/SmartThings/blob/master/devices/Pushbullet.groovy
3., you head to My Devices and click “+ New Device”. Give it a name, a Device Network ID, select “Pushbullet” under type, and select the location and hub. Click create.
4. Go to the mobile app. In your things, there shoul…
joshua_lyon
(Josh, SharpTools.io Dashboard)
February 4, 2015, 9:35pm
3
Can you use the http://user:password@url format? I’m pretty sure that’s what the other Pushbullet solutions are doing:
def url = "https://${apiKey}@api.pushbullet.com/v2/pushes"
Now that Pushbullet is available for iOS, I thought it would be a good way to push messages to a single device since the ST app can’t currently do that and the text option is sometimes unreliable. Using @625alex ’s Pushbullet Device, I created Pushbullet Notifier.
5 Steps to Setup:
1. Go to https://www.pushbullet.com/ and sign up for an account. Also install Pushbullet on the device you want to receive notifications on.
2. Head to the IDE and in My Device Types install the device type below:
https://github.com/625alex/SmartThings/blob/master/devices/Pushbullet.groovy
3., you head to My Devices and click “+ New Device”. Give it a name, a Device Network ID, select “Pushbullet” under type, and select the location and hub. Click create.
4. Go to the mobile app. In your things, there shoul…
Pfffft. I didn’t even think to look for a PB solution. I’ll check it out, thank you.
Just FYI - the api key for PB is the username for the api, not the password. The password is left blank. That is why it is user@url instead of user:password@url
Huh- thank you.
I had written a small API in their V1 with some other code; the password is being passed as the PASSWORD, not the user. And that works, even though I do get an “unauthorized” in the body. I’ll check that, maybe this is a V2 thing?
Anyway, thanks for the help. I have the PB integration working!