APNS settings in postman using certificate - ios

I'm trying to create a request in Postman (prefer) to test the Push notification API out. My search mostly returned firebase or onesignal settings while I'm trying to send the request in raw directly to apple.
Can someone please help to setup and formulate a basic APNS request in postman?
I'm using this documentation page as a reference.
What I'm missing I think is where to specify the contents of the p12 file plus any other missing data.
I didn't get number 3 in the path variable.
:path =/3/device/00fc13adff785122b4ad28809a3420982341241421348097878e577c991de8f0
Listing 2 A POST request relying on a certificate
HEADERS
- END_STREAM
+ END_HEADERS
:method = POST
:scheme = https
:path = /3/device/00fc13adff785122b4ad28809a3420982341241421348097878e577c991de8f0
host = api.sandbox.push.apple.com
apns-id = eabeae54-14a8-11e5-b60b-1697f925ec7b
apns-push-type = alert
apns-expiration = 0
apns-priority = 10
DATA
+ END_STREAM
{ "aps" : { "alert" : "Hello" } }
Translated above into postman
I've a curl command in case it helps (it's in http2 though). Reference
Note: You MUST have curl 7.47+ with http/2 support compiled in
curl -v \
-d '{"aps":{"alert":"<message>","badge":42}}' \
-H "apns-topic: <bundle id>" \
-H "apns-priority: 10" \
--http2 \
--cert <certificate file> \
https://api.development.push.apple.com/3/device/<device token>

Related

Creating an issue with JIRA API `Anonymous users do not have permission to create issues in this project. Please try logging in first.`

I have a simple request that I am sending to a JIRA server
curl \
-D- \
-u 'api_key_label:api_key' \
-X POST \
--data '{"fields": {"project":{"key": "my_proj"}, "issuetype": {"name": "Bug"}}}' \
-H "Content-Type: application/json" \
https://my_instance/rest/api/2/issue/
When I send the request I get the response
{"errorMessages":[],"errors":{"project":"Anonymous users do not have permission to create issues in this project. Please try logging in first."}}%
If anyone has any experience with this I would appreciate some advice. Is the -u parameter supposed to base64 encoded?
Python
import requests
from requests.auth import HTTPBasicAuth
import json
data = json.dumps({"fields": {"project":{"key": "VER"},"summary": "summary": {"name": "Bug"}}})
url = 'https://my_instance:8080/rest/api/2/issue/'
headers = {
'Content-Type': 'application/json'
}
response = requests.post(url,auth=('email_accoount','api_key'),data=data,headers=headers)

Unable to get Linkedin to return data from socialActions v2 endpoints

I am using the Linkedin API OAuth 2.0 API and trying to perform a 'like' to a post or a comment using the new version 2 of the Linkedin API using the Postman client.
I have added the following permissions to the scope
r_liteprofile r_emailaddress rw_organization_admin w_organization_social r_organization_social w_member_social w_organization_social r_organization_social
And added the relevant callback, Auth & Access Token URLs to the postman request along with the Client ID and Client Secret ID.
When I perform a request to the \me v2 endpoint it returns relevant data.
When I perform the following GET request it gives me an not enough permissions error (even though it has been recently been accepted to the Marketing API for Linkedin)
https://api.linkedin.com/v2/socialActions/urn%3Ali%3Aorganisation%3A24799518/comments
I would expect to get data - but get a 403 status code and the error message below -
Not enough permissions to access: GET /socialActions/urn%3Ali%3Aorganisation%3A24799518/comments"
The cURL request looks as follows :
curl -X GET \https://api.linkedin.com/v2/socialActions/urn%3Ali%3Aorganisation%3A24799518/comments \
-H 'Authorization: Bearer {MY BEARER TOKEN HERE}' \
-H 'Content-Type: application/json' \
-H 'Postman-Token: 59c239c2-d1c7-48ee-9e5f-a894afde95dc' \
-H 'X-Restli-Protocol-Version: 2.0.0' \
-H 'cache-control: no-cache'
-- update --
I have manually tried this using cURL also with the X-Restli-Protocol-Version: 2.0.0 header and have the same issue. I am ultimately trying to use the API to like posts/comments etc..
Social Action Api is not applicable for organization|Page
GET https://api.linkedin.com/v2/socialActions/{shareUrn|ugcPostUrn|commentUrn}/comments
It is applicable for share|ugcPost|Comment
Use the following request to fetch the shares and use the share Id in the above request to get the comments for the post
GET https://api.linkedin.com/v2/shares?owners=urn:li:organization:24799518&q=owners&count=100

why is this parse.com rest api request failing?

i'm trying to send a parse.com push notification from ruby 1.8.7.
i got a test working with curl. but with ruby's net::http i'm getting Timeout::Error: Resource temporarily unavailable
how can i debug this? i don't know how to see why the parse server is responding differently or otherwise see what's happening. i tried sending the request to my own server and the headers looked ok to me.
i simplified what i'm doing to this:
http = Net::HTTP.new('api.parse.com', 443)
response = http.post("/1/push", "{\"where\":{},\"data\":{\"alert\":\"Elliot net http json test 1\"}}", {"X-Parse-Application-Id"=>"xxxxx", "Content-Type"=>"application/json", "X-Parse-REST-API-Key"=>"xxxxx"})
the json there is hard to read, it's from:
api_req = {:where => {}, :data => {:alert => "Elliot net http json test 1"}}.to_json
puts api_req
# {"where":{},"data":{"alert":"Elliot net http json test 1"}}
i also tried several other ways of sending a request with net::http. same result.
the curl request that worked was:
curl -X POST \
-H "X-Parse-Application-Id: xxxxxx" \
-H "X-Parse-REST-API-Key: xxxxx" \
-H "Content-Type: application/json" \
-d '{
"where": {},
"data": {
"alert": "Elliot curl test #4"
}
}' \
https://api.parse.com/1/push
i'm not using parse-ruby-client because i ran into problems with dependencies assuming a newer version of ruby. all i need to do is send some simple push notifications, and it seems like this should work without too much trouble.
can anyone help me get this working or tell me how to get some useful info about what's happening to debug?
As per the REST API Developers guide,
All API access is over HTTPS, and accessed via the https://api.parse.com domain.
So all you need to do is to add http.use_ssl = true.

Gcm not sended to apn when iOS app was killed

Gcm send to apn when foreground and background. <- send ok
But if Force Quit Application, gcm not sended to apn. <- send not ok
When Force Quit Application, apn is possible send notification because, "APN Tester" is send notification Available.
< test condition >
iPhone 4
7.1.2
object c code(GcmExample.app)
use curl
< curl --header "Authorization: key=$server_api_key" \
--header Content-Type:"application/json" \
https://android.googleapis.com/gcm/send \
-d "{\"data\":{\"title\":\"title\"},\"notification\":{\"body\":\"noti test\",\"content_available\":true},\"to\":\"$token\"}" >
< etc use >
"GcmServerDemo" tool
"APN Tester" tool
You should try a message that has high APNS priority e.g.
curl --header "Authorization: key=$server_api_key" \
--header Content-Type:"application/json" \
https://android.googleapis.com/gcm/send \
-d "{
'data': { 'title': 'title' }, \
'notification': {'body': 'notitest' }, \
'content_available': true, \
'to': '$token', \
'priority': 10,
}"
You need to set the priority explicitly to 10 else GCM assumes normal APNS priority which can get highly delayed.
Here is the GCM reference where you can read about the priority field.

Not found response from https://www.googleapis.com/youtube/v3/video

I followed the instructions on https://developers.google.com/youtube/v3/guides/authentication#OAuth2_Calling_a_Google_API
to check my access to the YouTube v3 API.
I got an access_token from this:
curl --data "code=4/XXX.YYY" \
--data "client_id=foo123.apps.googleusercontent.com" \
--data "client_secret=YYY" \
--data "redirect_uri=urn:ietf:wg:oauth:2.0:oob" \
--data "grant_type=authorization_code" \
https://accounts.google.com/o/oauth2/token
which returned:
{
"access_token" : "ya29.XYXYXY",
"token_type" : "Bearer",
"expires_in" : 3600
}
If I now check access with curl or in the browser
https://www.googleapis.com/youtube/v3/video?access_token=ya29.XYXYXY
I just got back "Not Found".
If I use another (phantasy) access_token or leave out the parameter the result is always the same, just "Not Found". I tried with "http" and "https".
Am I doing something wrong? Is the service just temporarily not available? Should I use v2?
Thanks for your time,
Axel.
Found it myself. The documentation is misleading for me. The sample it uses
https://www.googleapis.com/youtube/v3/video?access_token=ya29.XYXYXY
doesn't say that you need further parameters. The response "Not found" from the server is not helpful. Furthermore "video" must be "videos".
A correct test would be
https://www.googleapis.com/youtube/v3/videos?access_token=ya29.XYXYXY&id=12345678&part=snippet

Resources