Firebase Realtime DB "orderBy must be a valid JSON encoded path" - firebase

I'm writing a REST query for an app but I'm suddenly experiencing an error I've never gotten before. When I try to sort responses by their timestamp I get the error:
error: "orderBy must be a valid JSON encoded path"
My URL looks like https://{db url}.firebaseio.com/users/{user id}/surveys.json?auth={auth token}
My rules are set up like this:
And database is structured like this:
If I add ?orderBy="timestamp" the error shows up.
I am using correct quotation marks in query and have data indexed by timestamp in my rules. What could be happening here? Why would this suddenly no longer work after using it for a long time?

If you are using curl then
curl 'https://{db url}.firebaseio.com/users/{user id}/surveys.json?auth={auth token}&orderBy="timestamp"'
for fetch url :
https://{db url}.firebaseio.com/users/{user id}/surveys.json?auth={auth token}&orderBy="timestamp"

Related

Linkedin API V2 query by VanityName with ampersand doesn't work

Working example: https://api.linkedin.com/v2/organizations?q=vanityName&vanityName=apple
Basically this is working for any other company, except if it has a & in the name, for example:
cannot use this vanity name (doesn't seem to be a url encode problem on the client side):
johnson-&-johnson or johnson-%26-johnson
The error is always the same:
serviceCode: 100
status: 403
message: Unpermitted fields present in PARAMETER: Data Processing Exception while processing fields [/-johnson]
This is not a permission problem, its working with any other vanity name.
In the response the uri seems to be messed up: https://api.linkedin.com/v2/organizations?-johnson=&q=vanityName&vanityName=johnson-
It should equal the request which is https://api.linkedin.com/v2/organizations?q=vanityName&vanityName=johnson-%26-johnson.
Also documentation doesn't seem to mention this use case.
Some other examples that work
https://api.linkedin.com/v2/organizations?q=vanityName&vanityName=johnson-controls-middle-east-africa
https://api.linkedin.com/v2/organizations?q=vanityName&vanityName=lowe's-home-improvement

Paw app query request

Hi I am attempting to initiate a query to my backend on Kinvey which is backed by a MongoDB. They require passing URL parameters as such:
?query={"firstName":"James"}
I have tried every imaginable way of setting up these parameters in PAW but either get a success response with no filtering of the data or an error message of URL not supported when I try using a Raw Query String.
I have ran the query using their (Kinvey) backend API interface and it works fine in filtering the results so the problem definitely lies within PAW. I am currently using version 3.0.9. Any suggestions or is this just a bug that needs to be fixed?
Thanks!
I've just tried this setup in Paw and I have a few recommendations:
Paw will URL-encode the chars { and " as you can see if you open the HTTP preview in the bottom panel
Trying to send a similar query via Chrome (to test with another app to make sure Paw behaves correctly), I see that the query is URL encoded (try this query https://echo.paw.cloud/?query={"firstName":"James"} you'll see that the browser actually URL-encodes the characters { and " when sending. So the behavior is the same with Paw.
I don't think these two chars ({ and ") are valid HTTP if they are not URL-encoded, so I'm sure your server is expecting them encoded anyway
Testing this exact query in Paw, works for me, so please try these exact steps: go to URL Params, in the first column enter query and {"firstName":"James"} in the second column. Then using the HTTP preview mentioned above, make sure Paw is sending the request you're expecting.
Lastly, it's more like a tip, but as your value is JSON, I recommend that you use the JSON dynamic value to generate the JSON. It will be visually better for you, and will make sure you send valid JSON. For that, right click on the value field, and select Values > JSON. Here's some example:

Getting S_412_PRECONDITION_FAILED=Invalid arguments error in Linkedin share api

When try to update status with link in linkedin api i'm getting this error frequently.
Example Link:
http://www.world-grain.com/articles/news_home/World_Grain_News/2016/06/General_Mills_files_patent_on.aspx?ID={30B4213B-4E10-4AF6-9B56-0D5614D7AFD3}&cck=1
If i remove the { and } from the link it get posted. Even in linkedin site itself its not working.
Help me if anyone know the reason.
I was receiving the same error and the reason was that I didn't send values for all the keys in request's body. For example: "content" parameter in linkedin's request body is a dictionary with 4 keys:
title
description
submitted-url
submitted-image-url
I had no image url so I didn't set the key "submitted-image-url" at all. The solution was to set the value to empty string "".
I wonder why linkedin can't parse dictionary if it doesn't have all the keys but that's the way it works.
Hope this helps
You may need to URL encode the braces in your link:
http://www.world-grain.com/articles/news_home/World_Grain_News/2016/06/General_Mills_files_patent_on.aspx?ID%3D%7B30B4213B-4E10-4AF6-9B56-0D5614D7AFD3%7D&cck=1
I ran into the same error when I attempted to pass a URL with spaces. It published successfully after URL encoding the spaces (%20).

URL filtering , issues with URL

I am working on a URL filtering project . I have a database given to me which contain URLs need to be blocked (eg: a.b.com/d/e).
I get uri and domain from http request. I compare what I get with my database and redirect users without any problem. So far so good.
Problems starts with urls that contains query string and other magics with URL. As an example if user enters a.b.com/d/e?junk. What I get won't match with my database, and users will bypass my filter and they will still be able to go a.b.com/d/e.
I tried some useless actions like slicing everything after special chars like "?,#". But having problems with url like : youtube.com/watch?v=12vh55_1ul8, which becames like youtube.com/watch and blocks all youtube. That solution causes me more problems.
Now I am very confused how to handle this problem. Is there any guide or any library which I can use in C++ ?
Try this code:
string str (get_requsted_uri());
string str2 ("http://getaroundfilters.com/article/889/proxy");
if (str.find(str2) != string::npos) {
block();
} else {
get_and_return_webpage(str);
}

Fql access error in C# .net?

I am trying to access the following info using FQL in c# .However am getting an HTTP bad request error
string Frnds = api.Get("/fql?q=SELECT+uid+name+username+locale+affiliations+timezone+birthday+sex+proxied_email+current_location+FROM+user+WHERE+uid=me()");
Is there some problem with my query , It seems to look fine to me ?
Have you tried separating each field name with a comma (,) then urlencoding it
you can test out your query here - please note in the following link I added in ","
https://developers.facebook.com/tools/explorer?method=GET&path=fql%3Fq%3DSELECT%20uid%2C%20name%2C%20username%2C%20locale%2C%20affiliations%2C%20timezone%2C%20birthday%2C%20sex%2C%20proxied_email%20%2Ccurrent_location%20FROM%20user%20WHERE%20uid%3Dme%28%29
your query can't parse the fields correctly
https://developers.facebook.com/tools/explorer?method=GET&path=fql%3Fq%3DSELECT%20uid%20name%20username%20locale%20affiliations%20timezone%20birthday%20sex%20proxied_email%20current_location%20FROM%20user%20WHERE%20uid%3Dme%28%29

Resources