How to specify constraint in Meteor Http call? -
I have to pass a barrier (where username = "user 1") in Meteor HTTP call for pars rest apis. Currently, the results I get after the API call given below include not only all those entries where the user name is user.
var authUrl = "https://api.parse.com/1/class / ImageData"; Meteor.http.call ("GET", authUrl, {Headers: {"X-Parse-Application-ID": "2CMX1b4JY5xCOPRYEbSc69ucNDDh9pl5yFeqv3A3", "X-Pars-REST-API-Key": "9UWYY6U7UUBOAEGT7R 3 NQARA 67 UXZxCMHJEAUU "," Content-Type ":" Application / json "}, Parameters: {" User Name ":" User1 ",}}, Function (Error, Result) {console.log (JSON.parse ( Result.content));}); There is a purse documentation for such an HTTP call in the representation of curls:
curl-get x - h "x-pars- Application-ID: 2CMX1b4JY5xCOPRYEbSc69UNDDh9pl5yFeqv3A3 "\ -H" X-Pars-REST-API-Key: 9UWpw6H7UuBaOEQgT7R3ANQ3rE67yxZxcMHJJaBu "\ -G \ --Data- urlencode 'where = {" user name ":" User1 "}' \ https: // Api.parse.com / 1 / class / image data How can I write it in a reverse way?
It seems that it works:
var util = Npm.require ('use'); Var url = 'https://api.parse.com/1/classes/ImageData'; Var Results = HTTP.get (url, {headers: {'X-Parse-Application-Id': '2CMX1b4JY5xCOPRYEbSc69CUndDh9pl5yFeqv3A3', 'X-Pars-Rest-API-Key': '9UWpw6H7UuBaOEQgT7R3ANQ3rE67yxZxcMHJJaBu', 'Content-Type': ' Application / jason '}, query:' where = {"user name": "user1"} '}); Console.log (util.inspect (result.data, {Depth: zero}));
note
-
Meteor.http.call is excluded Use API instead. Note that you $ meteor add http
-
will be required because you need a string and there is no key / value pair, instead of query parameter . For GET, both are placed in the query string but your original code has ? User name = user1 instead of where ... is created.