Postman - Push GCM to iOS with Postman - ios

I am trying to test GCM to my app with Postman. But It is not authorized.
In the header i put for
Key : The Server key (auto created by Google Service)
Value : application/json
And in Body - Raw :
{ "data": {
"score": "5x1",
"time": "15:10"
},
"to" : "lKVLmzMmvoU:APA91bFrbpmT4IAxS-rN9sr_y8-YDgrySaC7bMx3Pm_Qd-uEb7dfMnMaJRvNfPTj9c1YdhBJp6ClbsIvMKogmet9V0-HV_sgkBNUx59Rq25Ccbys0NWuuh_Mpd7ryK-98pxRV7B2WW63"
}
The value for "to" is the token I got from the GCM Registration.
But I have this response :
<HTML>
<HEAD>
<TITLE>Unauthorized</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000">
<H1>Unauthorized</H1>
<H2>Error 401</H2>
</BODY>
</HTML>
Thank you !

Each line within Postman is a key-value pair, your values should look something like this:
Postman have a great guide here with lots more helpful tips.

Related

Updating Created Date in OneNote page with PATCH

Using Microsoft Graph, body, title, etc. seem easy to update, but I can't seem to figure out the right syntax for created date. I'm making a copy of a current page (only way to get lined pages, it seems) and want the created date to reflect when the target created date should be.
Here is the content in OneNote:
<head>
<title>New Title</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="created" content="2019-07-22T09:00:00.0000000" />
</head>
I've tried
data=json.dumps([
{
"target": "meta: #created",
"action": "replace",
"content": "2019-07-23T09:00:00.0000000"
}
])
and
data=json.dumps([
{
"target": "created",
"action": "replace",
"content": "2019-07-23T09:00:00.0000000"
}
])
but get
{
"error": {
"code": "20134",
"message": "The Patch request message is invalid: The selected target meta: #created is not a valid updateable element.",
"innerError": {
"request-id": "156f1db9-a331-4ee4-96f8-15d90d393f63",
"date": "2019-06-12T12:25:54"
}
}
}
What would be the right syntax?
Patch the page's CreatedDate is not currently supported. How are you copying the page? If you use the Graph OneNote API https://learn.microsoft.com/en-us/graph/api/page-copytosection?view=graph-rest-1.0&tabs=cs won't you get the correct CreatedDate on the copied page?
You can set the Page title to the meeting time using Patch-pages-content with target=title

The request was missing an Authentification Key FCM Token

I am trying to hit using postman firebase url but it is giving me error.
I have setup all the things but it still it is giving me error
Here is the error which I am getting on postman
<HTML>
<HEAD>
<TITLE>The request was missing an Authentification Key (FCM Token). Please, refer to section "Authentification" of the FCM documentation, at https://firebase.google.com/docs/cloud-messaging/server.</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000">
<H1>The request was missing an Authentification Key (FCM Token). Please, refer to section "Authentification" of the FCM documentation, at https://firebase.google.com/docs/cloud-messaging/server.</H1>
<H2>Error 401</H2>
</BODY>
</HTML>
These things I am adding <br/>
url = 'https://fcm.googleapis.com/fcm/send'<br/>
method = POST<br/>
Headers <br/>
Authorization = 'FIREBASE_SERVER_API_KEY'<br/>
Content-Type = application/json<br/>
Body =
"{"registration_ids":["ids"],"priority":"high\",\"data\":{\"notification_id\":76,\"title\":\"dvxcv\",\"description\":\"xcvxv\",\"image\":\"/uploads/image/image/37513/Screenshot_from_2016-10-17_10_43_59.png\"}}"
All you need to do first in Header
Authorization: key='FIREBASE_SERVER_API_KEY'
And you are having problems with json parsing you have to remove '/'
{"registration_ids":["ids"],"priority":"high","data":{"notification_id":76,"title":"dvxcv","description":"xcvxv","image":"/uploads/image/image/37513/Screenshot_from_2016-10-17_10_43_59.png"}}
Edit
For any confusion follow my tutorial
how to integrate firebase with ruby on rails
Under Headers, Authorization: key=AAAA.....
HAVE TO ADD "key=" in front of the Firebase Server key token!!!

Accessing Twitter Sample Streaming Endpoint?

I'm trying to access the following GET https://stream.twitter.com/1.1/statuses/sample.json end-point in these docs.
From POSTMAN, I set an Authorization header with a value of Basic X where X is equal to the base64 encoding of $ConsumerKey:$ConsumerSecret.
When issuing the GET call from POSTMAN, I see the following prompt:
Confused as to why my OAuth credentials aren't accepted, I entered my Twitter user and password.
But, the server replies with:
<html>\n
<head>\n
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>\n
<title>Error 401 Unauthorized</title>
</head>
<body>
<h2>HTTP ERROR: 401</h2>
<p>Problem accessing '/1.1/statuses/sample.json'. Reason:
<pre> Unauthorized</pre>
</body>
</html>
In addition, I typed in my Consumer Key and Secret for the user and password prompt, but that failed too.
So, how can I hit this endpoint from POSTMAN? I'm not entirely sure if it's a stream. If it is, would I still be able to hit it via POSTMAN?

Sending Parse Push Notification via website

I've been using Parse for years to send Push Notifications to my iOS apps and its been working great.
I now want to be able to do the same thing - but from my own web page. Meaning, I wanna just go to a regular web page (which I'll create), type some text into a textfield, press a button - and have that text get sent as a Push Notification to my iOS App.
I’ve tried the following code - no luck so far:
<html>
<head>
<title>PN TEST</title>
<script type="text/javascript" src="jquery-1.7.2.js"></script>
<script type="text/javascript" src="http://www.parsecdn.com/js/parse-1.2.0.min.js"></script>
<script type="text/javascript">
Parse.initialize("xxxxxxxxxxxxx", "xxxxxxxxxxxxxxx");
function makePushNotification() {
alert ('sending a push!');
$.ajax({
type: 'POST',
headers: { 'X-Parse-Application-Id’ : ‘xxxxxxxxxxxxxxxxxxxxxxxx’ , 'X-Parse-REST-API-Key’ : ‘xxxxxxxxxxxxxxxxxxxxxxxxxxx' },
url: "https://api.parse.com/1/push", data: '{"channel": "", "data": {"alert": "Sending a Push Notification from my web page."} }',
contentType: "application/json"
});
}
</script>
</head>
<body>
Enter your push notification: <br/>
<form id="testForm">
<textarea cols="60" rows="4" id="textAreaText"></textarea>
<br/>
<input type="button" value="Send Push Notification" onclick="makePushNotification()" />
<br/>
</form>
</body>
</html>
(Obviously I'm hard-coding the actual text of the Push Notification here and not really reading it from the textarea box - but that's just for right now.)
Anyway, any ideas what this is missing?
contentType: "application/json" should be a header.
'Content-Type': 'application/json'

Linkedin REST API Auth and JSAPI call, Rails/Omniauth

I lost my temper few days ago because of this simple problem. Can you help me on this?
I'm suppose, since it's written in the Linkedin JS API documentation here, to be able to logion with REST and launch calls with JSAPI :
https://developer.linkedin.com/documents/inauth-inevent-and-inui
Authorization Tokens
While the easiest method of authenticating a user for the JSAPI is to
use one of the login buttons, some sites have implemented the OAuth
1.0a flow used by the REST API. Whichever type of authentication you use for the user, the JSAPI will recognize that the member has already
logged in, as long as the key and hostname are the same. This happens
automatically, requiring no additional code by the developer.
But this is NOT working, I have this weird console error :
Cannot call method 'Profile' of undefined
when I call this right after REST auth:
IN.API.Profile("me").fields(["id", "..."]).result(linkedin_connect_save);
Any ideas?
That console error doesn't have anything to do with authentication - I'm guessing you're loading another javascript framework which is interfering with the LinkedIn framework and the IN object isn't getting properly loaded.
The following page works with a key that I've previously authenticated using REST in the same browser here: http://developer.linkedinlabs.com/tutorials/testing.html
<html>
<head>
<title>Connections App Example</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</head>
<body class="yui3-skin-sam yui-skin-sam">
<script type="text/javascript" src="http://platform.linkedin.com/in.js">
api_key: MY_API_KEY
onLoad: loadData
authorize: true
</script>
<script type="text/javascript">
function loadData() {
IN.API.PeopleSearch()
.fields("firstName", "lastName", "distance", "publicProfileUrl","pictureUrl")
.params({"keywords": "princess", "count": 10, "sort": "distance"})
.result(function(result) {
alert(JSON.stringify(result));
});
}
</script>
</body>
</html>
your code might call before js load..
include js before ur code..

Resources