I have a problem with parse api. I'm sending this data:
{
"where": {
"deviceType": "android"
},
"data": {
"action": "somestring",
"aps": {
"alert": "some title",
"id": 4353453,
"s": "some_short_string"
}
}
}
to https://api.parse.com/1/push using POST method with headers:
Content-Type: "application/json",
X-Parse-Application-Id: "myid",
X-Parse-REST-API-Key: "mykey",
User-Agent: "PHPWebapiClient"
Api returns mostly status 200, but sometimes it returns 404. Of course in this case notifications wont work, and even don't appear in parse admin. It seems totally random, i can't determine the cause. Interestingly api always return this header:
http_code: "HTTP/1.0 200 Connection established"
no matter what response code is returned.
I tried resending request, but this didn't help.
Is there anyone experiencing similar problems? Please help me sort this out.
Related
To create a webhook, it has to pass the following validation:
Receive a GET request onto the webhook URL and read a specific "challenge" field from the query.
Send this field back to where the request comes.
Can this be implemented in an Integromat app?
Yes, you can use the verification directive for this purpose.
The code would look something like this:
{
"verification": {
"condition": "{{if(query.challenge, true, false)}}",
"respond": {
"status": 200,
"type": "json",
"body": {
"challenge": "{{query.challenge}}"
}
}
},
"response": {
"output": "{{body}}"
}
}
It's up to you to specify the verification condition so that the platform will be able to tell if the incoming message is a verification request or a regular webhook payload.
I'm trying to query my Firestore database using an HTTP query via the Insomnia API:
https://firestore.googleapis.com/v1/projects/typebot/databases/(default)/documents/users
with this body:
{
"structuredQuery": {
"from": [
{
"collectionId": "users"
}
],
"where": {
"fieldFilter": {
"field": {
"fieldPath": "email"
},
"op": "EQUAL",
"value": {
"stringValue": "email#test.com"
}
}
}
}
}
And I get the following error:
HTTP query: Stream error in the HTTP/2 framing layer
Any idea what's wrong?
May try to change "GET" to "POST"
I had a similar problem performing a GET request:
GET https://us-central1-my-project-id.cloudfunctions.net/getUsers HTTP/1.1
content-type: application/json
{
"minAge": "18"
}
against an endpoint defined by this Firestore HTTP Cloud Function:
exports.getUsers = functions.https.onRequest(async (req, res) => {
// find matching users by age limit.
const ageLimit = req.body.age;
...
});
Turns out, based on this other SO post, that a request body with GET does not have any meaning in the sense that the HTTP spec recommends that the "message-body SHOULD be ignored when handling the request" (presumably, by the server, and that the Firestore server implements this behavior). Oddly, I didn't catch this issue running the exact same function locally with the Functions emulator, so it is likely the local server ignores this recommendation.
To fix the issue, I changed my function to parse the query params instead of a request body:
exports.getUsers = functions.https.onRequest(async (req, res) => {
// find matching users by age limit.
const ageLimit = req.query.age; // extract the age as a query param
...
});
and the request:
GET https://us-central1-my-project-id.cloudfunctions.net/getUsers?age=18
Unable to share image content through share endpoint, image asset is uploaded through assets API but my request to share API which is copied directly from the example here https://learn.microsoft.com/en-us/linkedin/marketing/integrations/community-management/shares/share-api?context=linkedin/compliance/context#share-content returns an error, invalid parameters in the request body [/Headers] see below details.
Request Headers:
{Authorization: Bearer ***
X-Restli-Protocol-Version: 2.0.0
}
Request Body
{"content":{"contentEntities":[{"entity":"urn:li:digitalmediaAsset:C5622AQEEn3mmqzCb5w"}],"title":"Great Result","landingPageUrl":"https://google.com.au","shareMediaCategory":"IMAGE"},"distribution":{"linkedInDistributionTarget":{}},"owner":"urn:li:person:zzR_UbXjsG","subject":"Great Result","text":{"text":"Great result, couldn't have gone better #realestate"}}
Scopes:
scope=r_emailaddress w_member_social w_organization_social r_basicprofile rw_company_admin rw_organization_admin
Error:
{"serviceErrorCode":100,"message":"Unpermitted fields present in REQUEST_BODY: Data Processing Exception while processing fields [/Headers]","status":403}
It looks like the error message has to do with the headers. Your request body is JSON, but you don't have a Content-Type header set, so this could be the problem:
Content-Type: application/json
Generally, you need a Content-Length header to be sent along with that, but most of the time the client you are using to send the request handles setting that one.
I'm not sure how you're making the request, but here is a fetch() example in JavaScript (make sure you put the correct auth token in the Authorization header):
const url = 'https://api.linkedin.com/v2/shares';
const requestBody = {
"content": {
"contentEntities": [
{
"entity": "urn:li:digitalmediaAsset:C5622AQEEn3mmqzCb5w"
}
],
"title": "Great Result",
"landingPageUrl": "https://google.com.au",
"shareMediaCategory": "IMAGE"
},
"distribution": {
"linkedInDistributionTarget": {}
},
"owner": "urn:li:person:zzR_UbXjsG",
"subject": "Great Result",
"text": {
"text": "Great result, couldn't have gone better #realestate"
}
};
async function makeRequest(url, requestBody) {
const response = await fetch(url, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer ***',
'X-Restli-Protocol-Version': '2.0.0'
},
body: JSON.stringify(requestBody) // body data type must match "Content-Type" header
});
return await response.json(); // parses JSON response into native JavaScript objects
}
// make the actual request
makeRequest(url, requestBody);
Up until last week, the only resonable path available (for a lot of reasons) to use Firebase in a Xamarin.Android app required using Firebase.Xamarin. However, this appears to have stopped working as well.
Specifically, I had been able to successfully make the following call in my Android and iOS apps and get successful responses:
var contentString = $"grant_type=refresh_token&code=string&refresh_token={auth.RefreshToken}";
var requestContent = new StringContent(contentString, Encoding.UTF8, "application/x-www-form-urlencoded");
var uri = new Uri(string.Format("https://securetoken.googleapis.com/v1/token?key={0}", this.authConfig.ApiKey));
var response = await client.PostAsync(uri, requestContent).ConfigureAwait(false);
var responseData = await response.Content.ReadAsStringAsync().ConfigureAwait(false);
As of yesterday, I started getting the following responseData from the above code:
iOS:
{
"error": {
"code": 403,
"message": "Requests from this ios client application \u003cempty\u003e are blocked.",
"status": "PERMISSION_DENIED",
"details": [
{
"#type": "type.googleapis.com/google.rpc.Help",
"links": [
{
"description": "Google developer console API key",
"url": "https://console.developers.google.com/project/<my_apps_project_id>/apiui/credential"
}
]
}
]
}
}
Android:
{
"error": {
"errors": [
{
"domain": "usageLimits",
"reason": "ipRefererBlocked",
"message": "The request did not specify any Android package name or signing-certificate fingerprint. Please ensure that the client is sending them or use the API Console to update your key restrictions.",
"extendedHelp": "https://console.developers.google.com/apis/credentials?project=<my_apps_project_id>"
}
],
"code": 403,
"message": "The request did not specify any Android package name or signing- certificate fingerprint. Please ensure that the client is sending them or use the API Console to update your key restrictions."
}
}
After some research, I found this Google Cloud Endpoints Google Groups thread that said to be sure the following are in the http request's headers:
Header x-android-package
Label servicecontrol.googleapis.com/android_cert_fingerprint
Header x-android-cert
Label servicecontrol.googleapis.com/android_package_name
Header x-ios-bundle-identifier
Label servicecontrol.googleapis.com/ios_bundle_id
I added client.DefaultRequestHeaders.Add("X-Ios-Bundle-Identifier", <my_apps_bundle_id>); to my code before the client.PostAsync and it works like a charm.
Moving on to Android, I added "x-android-cert" and x-android-package to the request headers:
client.DefaultRequestHeaders.Add("x-android-cert", <my_apps_SHA1>);
client.DefaultRequestHeaders.Add("x-android-package", <my_apps_package_id>);
prior to my client.PostAsync call. However, now I get the following responseData:
{
"error": {
"errors": [
{
"domain": "global",
"reason": "internalError",
"message": "Internal Error"
}
],
"code": 500,
"message": "Internal Error"
}
}
A moment of venting: For me, this is almost the last straw when it comes to Firebase. It has been over a month of overcoming one undocumented and half-baked API/SDK after another. It seems as if NOTHING works as advertised (including - off topic - getting Firebase working with an Angular4 project). Thank you for letting me share my frustration. Had I known how painful this was going to be, I would have setup my own MBaaS.
Before I give up on Firebase, I wanted to ask for help with this issue. Any insights and assistance would be greatly appreciated.
EDIT 1:*
I get similar results with the following changes:
var requestContent = new StringContent(postContent, Encoding.UTF8, "application/json");
var uri = new Uri(string.Format("https://www.googleapis.com/identitytoolkit/v3/relyingparty/verifyAssertion?key={0}", this.authConfig.ApiKey));
I have a Worklight adapter that calls a RESTful method through WL.Server.invokeHttp(). When an http DELETE method is used, the query string parameters do not get added. I'm on Worklight 6.0.
The input is setup like so:
{
"headers": {
"Accept": "application\/json",
"Authorization": "Bearer xxxxxxxxxxxxxxxx",
"Content-Type": "application\/json"
},
"method": "delete",
"parameters": {
"messageIds": "r11118,r11119"
},
"path": "\/myMessages\/v2\/messages"
}
and called like: var result=WL.Server.invokeHttp(input);
But I can see from Wireshark that the query params don't get added:
DELETE /myMessages/v2/messages HTTP/1.1\r\n
If all I do is change the method to a GET, the params are there on Wireshark:
GET /myMessages/v2/messages?messageIds=r11118%2Cr11119 HTTP/1.1\r\n
Sounds like a bug. We'll investigate it and fix in next releases if confirmed.