Pushbullet: No notifications in official Chrome extension when pushing via API - pushbullet

The official Chrome extension isn't behaving as I'd expect (and is not what how it behaved before). I've uninstalled and reinstalled it from Chrome store before doing this.
Using the randomchars pushbullet python client (https://github.com/randomchars/pushbullet.py):
from pushbullet import PushBullet
$key=...
pb=PushBullet($key)
s,p=pb.push_note("title","body")
The above note should be pushed to all devices. But while it appears on the official android app, it does not appear on the official Chrome extension.
However, the following works and is displayed on the Chrome extension:
c=pb.devices[0] # Chrome client
s,p=c.push_note("title","body")
Tried a variant using curl. This push is displayed on the official Android client, but not the official Chrome extension:
curl -u "${key}:" -X POST --header 'Content-Type: application/json' https://api.pushbullet.com/v2/pushes --data-binary '{"type": "note", "title": "Note Title", "body": "Note Title"}'
But acting on a hunch after comparing the differences in metadata between displayed pushes and non-displayed notifications, I added a "source_device_iden" tag (matching my Android client), and this was displayed on the offical Chrome extension:
curl -u "${key}:" -X POST --header 'Content-Type: application/json' https://api.pushbullet.com/v2/pushes --data-binary '{"type": "note", "title": "Note Title", "body": "Note Title", "source_device_iden": "uSOMETHING"}'
Does the Chrome extension now require either source_device_iden or dest_device_iden to be populated or something?

This was a bug that we fixed yesterday. Thanks for letting us know!

Related

Hitting the GitHub api for listing PR comments returns no result

I want to list (count actually) the comments made on a GitHub pull request.
As per the documentation, I am using the following curl command to hit the GitHub API
curl -H "Accept: application/vnd.github+json" -H "Authorization: token abcdefg123457" https://api.github.com/repos/MyOrg/MyRepo/pulls/2/comments
The result is the following:
[
]
despite me seeing comments on #PR2.
What am I missing?

How to automate BrowserStack screenshot API on my localhost?

I tried to go through their Screenshots API & Local testing but got lost in between..
All I want is to test my front-end style guide (language agnostic), can someone direct me to a good direction please?
Generating screenshots for internal URL via Screenshots API is a two-step process:
a) Setup Local Testing using the BrowserStack Local binary. The command is as follows:
./BrowserStackLocal --key KEY
More details on Local Testing is available here.
b) Add the parameter "local" = true in your Rest API. For more information, refer.
Example for generating a screenshot for localhost on Windows 7-IE 8:
"UserName:KEY" -H "Content-Type: application/json" -H "Accept: application/json" -d '{"browsers": [{"os": "Windows", "os_version": "7", "browser_version": "8.0", "browser": "ie"}], "url": "http://localhost", "local": "true"}' https://www.browserstack.com/screenshots
Note: The access key for your account can be acquired from here.

mailjet rest api /send doesn't work

I tried this example in the console from the https://dev.mailjet.com/ :
curl -s -X POST --user "user:pass" https://api.mailjet.com/v3/REST/send -H 'Content-Type: application/json'
and the result is always
{ "ErrorInfo" : "", "ErrorMessage" : "Unknown resource: \"send\"",
"StatusCode" : 400 }
If I try other get requests, like /contact the result is with success.
Please help
The URL you're using is not the right one. Please change it to https://api.mailjet.com/v3/send.
Please visit the dedicated API guide for our transactional API here https://dev.mailjet.com/guides/#send-transactional-email
Hope it helps.
hAPI coding with Mailjet API!

how to send correct curl command to webserver

So I got the data that is being sent to a specific server. Now I want to do the same using curl from my local machine to play around with specific repsonses from the server and learn more about curl as well.
Here is part of my data
POST /auth HTTP/1.1
platform: android
X-Auth-Token: <censored>
Content-Type: application/json; charset=utf-8
Host: api.blabla.com
Accept-Encoding: gzip
And the data that is being sent:
{"blabla_token": "sdsadsad", "blahblah_id": "23213", "locale": "us"}
Now when I try cURL in my dos shell, I try
curl --insecure -X POST https://api.blabla.com/auth --data '{"blabla_token": "sdsadsad", "blahblah_id": "23213", "locale": "us"}'
The response I get from cURL is this:
{"code":401,"error":"blablaTokenRequired"}
Even though I specified the token. So there are two possible scenarios because the token is correct:
It has something to do with the SSL thing? (I use --insecure because I get an SSL error otherwise)
Something about my command is not correct but I can't figure out what.
Can someone kindly help me out? I am trying everything I can without success
I am not sure if I understand your application specific right, but probably one thing you need to take into account:
man curl says:
-d, --data <data>
(HTTP) Sends the specified data in a POST request to the HTTP server, in the same way that a browser does when
a user has filled in an HTML form and presses the submit button. This will cause curl to pass the data to the
server using the content-type application/x-www-form-urlencoded. Compare to -F, --form.
-d, --data is the same as --data-ascii. --data-raw is almost the same but does not have a special interpreta‐
tion of the # character. To post data purely binary, you should instead use the --data-binary option. To URL-
encode the value of a form field you may use --data-urlencode.
As I can't see in your example the necessity of sending data as HTML form input, probably your application expects just a "raw" POST body and then you have to try this:
curl --insecure -X POST https://api.blabla.com/auth --data--binary '{"blabla_token": "sdsadsad", "blahblah_id": "23213", "locale": "us"}'
PS and for sure this is error is not about using --insecure which just asks curl to neglect ssl verification
you forgot the headers and enabling compressed encoding (gzip), however, i believe you can't force curl to only support gzip encoding using the curl command line alone, you will have to use libcurl, this will make the request say "Accept-Encoding: gzip,deflate" on most systems, using --compressed .. if that's not acceptable to you, rewrite it using libcurl (where you can force it to say only "gzip", if you wish, via CURLOPT_ENCODING )
curl -X POST https://api.blabla.com/auth --data '{"blabla_token": "sdsadsad", "blahblah_id": "23213", "locale": "us"}' --header 'platform: android' --header 'X-Auth-Token: <censored>' --header 'Content-Type: application/json; charset=utf-8' --header 'Host: api.blabla.com' --compressed
another gotcha: on some systems, there will be a default useragent header (like debian 6), while on some systems, curl comes without a default useragent (like debian 8).. you might want to use --user-agent '' too

Pushbullet API from cURL - invalid request

I'm working on an app using Pushbullet's API, but I'm running into odd errors when running through the sample code at https://docs.pushbullet.com/v2/pushes/.
I'm executing the following cURL command (in Windows):
curl -k -u <MY_API_KEY>: -X POST https://api.pushbullet.com/v2/pushes --header 'Content-Type: application/json' --data-binary '{"type": "note", "title": "Note Title", "body": "Note Body"}'
...but it keeps generating the following error:
{"error": {"type":"invalid_request","message":"The param 'type' has an invalid value.","param":"type","cat":"\u003e:3"}}
It also produces this error:
The other commands for the other endpoints in the documentation work fine...it's just this one.
Got any suggestions? Thanks for the help! :)
It looks like windows doesn't support those kinds of quotes on the command line. Here's an example that works:
curl https://api.pushbullet.com/v2/pushes -X POST -u <access token>: --header "Content-Type: application/json" --data-binary "{\"type\": \"note\", \"title\":\"Note Title\", \"body\": \"Note Body\"}"
I think I'm going to try to replace the curl examples with something that has less confusing behavior.
I figured it out - I don't really know why, but the cURL command wasn't working through the DOS prompt, and also wasn't working using the Postman REST client for Chrome, but I got it working in the DHC extension for Chrome. The trick was setting the Authorization header to "Basic", which resolves the Pushbullet access token to some other form, and makes a successful the HTTP request.
Hope this helps someone down the road if they run into this on Windows!