I've made a HTTP request by using Postman.
Method:POST.
Body (json) :
{
"value1" : ["1-JH"],
"value2": ["Test"],
"value3": true
}
But there is an error. Do you know how to fix it?
"message": "Missing header 'UUID'"
Difficult to guess the exact thing, without knowing more details about your API.
But you can set headers in Postman via the "Headers" tab:
Related
Hello I need help with http post request to my server and get response with authentication.
Look on the screens on 1 I use insomnia REST API application. Using this app I got success response with premium days and id.
In second image I got response just from my nativescript vue.js app where I got false response.
There is something wrong with my code. please tell me what.
You are sending a JSON object in your request body from {N} app, on the other hand you are using FormData with your REST client for testing.
You must either change your API to support JSON data on request body which is generally the standard way. In case if you can't do that, then you must use the nativescript-background-http plugin to send FormData. It will be something like,
var params = [
{ name: "username", value: "test" },
{ name: "password", value: "test123" },
{ name: "uuid", value: "xxxx" }
];
var task = session.multipartUpload(params, request);
I'm Trying to push notification from postman to firebase for testing
I posted using documentation tips and response is success but nothing sent to my android device .. I tested my code using debugging and firebase console and it working well but when i used postman nothing happens
This is my posting format
http://fcm.googleapis.com/fcm/send
Content-Type : application/json
Authorization: key=AAAAitv2sYo:APA91bENlw37p5pa7pMIKoVv8CroevA7tK3tVFNGUchhGf_zkeKVFdQeYcKQmxsg-2ZOkNHMAvloRjTugmZHzNBa_TLMR2_7lffglJvrKHT1TNixHxtXZimWi2f7c16M2M7ic2S5g1gC
{
"notification" :
{
"body" : "hello",
"title": "firebase",
"sound": "default"
},
"to" : "AAAAitv2sYo:APA91bENlw37p5pa7pMIKoVv8CroevA7tK3tVFNGUchhGf_zkeKVFdQeYcKQmxsg-2ZOkNHMAvloRjTugmZHzNBa_TLMR2_7lffglJvrKHT1TNixHxtXZimWi2f7c16M2M7ic2S5g1gC"
}
i used authorization and to is the same key " server key "
and the response is
{
"multicast_id": 9063339683658826188,
"success": 1,
"failure": 0,
"canonical_ids": 0,
"results": [
{
"message_id": "0:1533133178192931%0000000000000000"
}
]
}
Note : When i write https posting is failed and got Could not get any
response error when i made it http it get the above response
another question .. can i see the sent message in firebase console ?
The Authorization key in the header and the to property in the message have different purposes and are never the same value.
The Authorization key validates your request to the Firebase server. Its value is the "Server key" shown in the Cloud Messaging tab of your Project settings at the Firebase console.
The message to value is the registration ID of the device to which you are sending the message. It is obtained from a call to a client-side SDK.
I am trying to send FCM message through POSTMAN. I have added the server key, the one from cloud messaging in settings of firebase console.
What is missing here?
The example in the documentation for authorizing HTTP v1 send requests shows the Authorization header value starts with Bearer not key=:
headers: {
'Authorization': 'Bearer ' + accessToken
}
You should change format of you requests.
More info here: https://firebase.google.com/docs/cloud-messaging/send-message#send_messages_using_the_legacy_app_server_protocols
If you prefer to use the legacy protocols, build message requests as shown in this section. Keep in mind that, if you are sending to multiple platforms via HTTP, the v1 protocol can simplify your message requests.
HTTP POST request
https://fcm.googleapis.com/fcm/send
Content-Type:application/json
Authorization:key=AIzaSyZ-1u...0GBYzPu7Udno5aA
{ "data": {
"score": "5x1",
"time": "15:10"
},
"to" : "bk3RNwTe3H0:CI2k_HHwgIpoDKCIZvvDMExUdFQ3P1..."
}
Use following:
link: https://fcm.googleapis.com/fcm/send
"Authorization" "key=" + server key
Body
{
"to" : "/topics/carriers",
"notification" : {
"body" : "This message came from Server!",
"title" : "FROM POSTMAN"
}
}
for me this is the only configuration that works
//body its like this
{
"to":
"/topics/NEWS"
,
"data":{
"extra_information": "This is some extra information"
},
//notification that i need to give
"notification":{
"title": "ChitChat Group",
"text": "You may have new messages",
"click_action":"ChatActivity"
}
}
The 401 error pertains that your Authorization Key is invalid or incorrect.
When using Postman, add a key= prefix for the value of Authorization, like so:
key=AAA...
See below for a tutorial on Sending Downstream FCM Messages using Postman.
Also, for your notification message payload, text isn't one of the valid parameters, I think you were looking for message instead.
Sending Downstream Messages using Postman
To do this in Postman, you simply have to set the following:
Set request type to POST
In the Headers, set the following:
Content-Type = application/json
Authorization = < Your FCM Server Key > (See your Firebase Console's Cloud Messaging Tab)
Set the payload parameters in the Body (*in this example, we used the raw option, see screenshot (2)*)
Send the request to https://fcm.googleapis.com/fcm/send
Screenshots:
(1)
Note: Always keep your Server Key a secret. Only a portion of my key is visible here so it should be fine.
(2)
(3)
Notice that the request was a success with the message_id in the response.
Wrong:
Authorization:AIzaSyDDk77PRpvfhh......
Correct:
Authorization:key=AIzaSyDDk77PRpvfhh......
Full example:
https://fcm.googleapis.com/fcm/send
Content-Type:application/json
Authorization:key=AIzaSyZ-1u...0GBYzPu7Udno5aA
{ "data": {
"score": "5x1",
"time": "15:10"
},
"to" : "bk3RNwTe3H0:CI2k_HHwgIpoDKCIZvvDMExUdFQ3P1..."
}
While the answers above are still correct, you may choose to use HTTP v1. This requires Bearer instead of key= and uses an Oauth2 access token instead of a server key string. To view HTTP v1 specifications, please refer to the link below:
https://firebase.google.com/docs/cloud-messaging/migrate-v1
I was also getting same error in PHP , solved with below header :
$header = array("authorization: key=" . $this->apiKey . "","content-type: application/json");
I'm trying to get dataset list from bigquery webserver with https get
following the documentation here:
https://developers.google.com/bigquery/docs/reference/v2/datasets/list
i'm using slightly modified code from:
http://code.google.com/p/qt-google-bigquery/source/browse/manager_bigquery.cpp
getDatasetsList(QString strProjectID)
{
QString url = QString("https://www.googleapis.com/bigquery/v2/projects/%1/datasets?key=%2").arg(str_ProjectID).arg(this->api_key);
//Also tried without ?key= part
QNetworkRequest request;
request.setUrl( QUrl(url) ); //this also urlencodes
request.setRawHeader("Content-Type", "application/json");
request.setRawHeader("Authorization", (QString("Bearer %1").arg(m_Access_Token)).toLatin1());
//here i post the request as a http get asynchronously
}
i get back this error message:
Reply = "{
"error": {
"errors": [
{
"domain": "global",
"reason": "required",
"message": "Required parameter is missing"
}
],
"code": 400,
"message": "Required parameter is missing"
}
}
Note:
I managed to run a query and get the results, so my access token seems to be valid, what am i doing wrong here?
SOLVED
Ah, actually the problem was in my coding, not the request, i posted it as a http post, not a get.
See answer in comment by original poster above - but basically make sure you are using GET instead of the POST method for an API call to list datasets. Other BigQuery API methods use POST, PUT, or PATCH.
https://developers.google.com/bigquery/docs/reference/v2/datasets/list