• 10 dec 2017: forum version update. In case of issues use this topic.
  • 30 nov 2017: pilight moved servers. In case of issues use this topic.
Hello There, Guest! Login Register


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
pushbullet and pushover
#21
Good reminder.

Pushbullet:

Code:
method: POST

mimetype: application/json

data:   "type": "note", "title": "message title", "body": "message text"

request: https://<api key>@api.pushbullet.com/v2/pushes

Pushover:

Code:
method: POST

mimetype: application/x-www-form-urlencoded

data: token=<api key>&user=<user id>&title=message title&message=message text

request: https://api.pushover.net/1/messages.json
 
Reply
#22
Are you sure those are the actual HTTP headers which should look like this:
Code:
GET /tutorials/other/top-20-mysql-best-practices/ HTTP/1.1
Host: net.tutsplus.com
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.5) Gecko/20091102 Firefox/3.5.5 (.NET CLR 3.5.30729)
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Cookie: PHPSESSID=r2t5uvjq435r4q7ib3vtdjq120
Pragma: no-cache
Cache-Control: no-cache
 
Reply
#23
I only know how tho get the headers when  using a browser, but I wonder if that is what you mean.

However this is the header information when using the Chrome browser to call Pushbullet:

Code:
General:

Request URL: https://xxxxxxxxxxxxxxxxxxxx@api.pushbullet.com/v2/pushes
Request Method: GET
Status Code: 200
Remote Address: 172.217.17.51:443
Referrer Policy: no-referrer-when-downgrade


Response headers:

cache-control: private
content-encoding: gzip
content-length: 1269
content-type: application/json; charset=utf-8
date: Mon, 16 Jul 2018 15:49:17 GMT
server: Google Frontend
status: 200
vary: Accept-Encoding
x-cloud-trace-context: 6ca4d2210e52d1af8d49678d4716972f
x-ratelimit-limit: 16384
x-ratelimit-remaining: 16196
x-ratelimit-reset: 1531756325


I can only do invalid requests for Pushover and these are the headers then

Code:
General:

Request URL: https://api.pushover.net/1/messages.json
Request Method: GET
Status Code: 400 Bad Request
Remote Address: 108.59.13.232:443
Referrer Policy: no-referrer-when-downgrade

Response header:

HTTP/1.1 400 Bad Request
Server: nginx
Date: Mon, 16 Jul 2018 16:07:03 GMT
Content-Type: application/json; charset=utf-8
Transfer-Encoding: chunked
Connection: keep-alive
X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 1; mode=block
X-Content-Type-Options: nosniff
Access-Control-Allow-Origin: https://client.pushover.net
Access-Control-Allow-Methods: GET, OPTIONS, POST
Access-Control-Allow-Headers: X-Requested-With, X-Prototype-Version, Origin, Accept, Content-Type, X-CSRF-Token, X-Pushover-App, Authorization
Access-Control-Max-Age: 1728000
Cache-Control: no-cache
Set-Cookie: ps4=RUo2MDViVGY0akYveTBBdzBYYncweEtvNXdiRlUwRG5zTWRsYU5jNU8xZXVETTBKRW1XeG0zMDJaMWYzZlo0NjVwL21GSDU2UGpBbVZaeitveUtQeUZKWm56dko1dEpmWEIxK3ZCaUFORWV0SE5EM1dreVpkclJoYm9RNklaZU9ReXM1dSt4UUlCZ3Q2WW5MUEZTYklJQjJMRVB6bnZYMHdncmlRd2ZIQ041NTE2RjFSeHNKU3IwWWRKY2VCK1BELS1DR1IwM0xiSWk2TEVoOUNDVVRqcVB3PT0%3D--284661f8e724fddb802b3d6b6127cd07845881d7; domain=.pushover.net; path=/; expires=Wed, 15 Aug 2018 16:07:03 -0000; secure; HttpOnly
X-Request-Id: 4c245d57-ded1-47c8-a5ff-d4655851a69a
X-Runtime: 0.008473
 
Reply
#24
You can use pilight to check the headers. Just add a printf in the http.c library in read_cb here:
Code:
    if(*nread > 0) {
        buf[*nread] = '\0';
    }
    printf("%s\n", buf);
 
Reply
#25
I will do that asap.
 
Reply
#26
Here are the headers I got with the printf.

Pushover headers:

Code:
HTTP/1.1 400 Bad Request
Server: nginx
Date: Tue, 17 Jul 2018 14:49:31 GMT
Content-Type: application/json; charset=utf-8
Connection: close
X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 1; mode=block
X-Content-Type-Options: nosniff
Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: POST, OPTIONS
Access-Control-Allow-Headers: X-Requested-With, X-Prototype-Version, Origin, Accept, Content-Type, X-CSRF-Token, X-Pushover-App, Authorization
Access-Control-Max-Age: 1728000
Cache-Control: no-cache
X-Request-Id: a0c84dd2-75b7-465b-9a99-505a1ab5e462
X-Runtime: 0.012411
 

Pushbullet headers:

Code:
HTTP/1.0 200 OK
Content-Type: application/json; charset=utf-8
X-Ratelimit-Limit: 16384
X-Ratelimit-Remaining: 16384
X-Ratelimit-Reset: 1531842725
X-Cloud-Trace-Context: 1106ec116645d04e69145d905c1580d9
Date: Tue, 17 Jul 2018 15:02:01 GMT
Server: Google Frontend
Content-Length: 450
 
Reply
#27
In case of pushbullet is says content length 450, but i don't see any content.
 
Reply
#28
I didn't copy that part, because it contains information that I don't want to publish on the forum.
 
Reply
#29
Can you publish that content but with dummy information where it contains private data?
 
Reply
#30
This is the content part:

Code:
{"active":true,"iden":"xxxxxxxxxxxxxxxxxxxxxxx","created":1531896331.5908997,"modified":1531896331.6010456,"type":"note","dismissed":false,"direction":"self","sender_iden":"xxxxxx","sender_email":xxx@xxxxxx.xxx,"sender_email_normalized":"xxx@xxxxxx.xxx","sender_name":"xxxxxxxxxxxxxxxx","receiver_iden":"xxxxxxxxxxxxxx","receiver_email":"xxx@xxxxxx.xxx","receiver_email_normalized":"xxx@xxxxxx.xxx","title":"test","body":"dit is een test"}
 
Reply
  


Forum Jump:


Browsing: 1 Guest(s)