httpPost with password

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: “”,
path: “/v2/pushes”,
body: [“type”:“note”, “title”:“Garage Warning”, “body”:“$msg”]

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).


Have you seen this thread? The code is all there to do notifications via pushbullet

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}"

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!