REST query URI

This forum contains topics that were moved from Get Satisfaction
dsimmeth
Posts: 0
Joined: Mon Dec 19, 2011 9:24 pm

REST query URI

Post by dsimmeth »

Can I call a REST service that does not user query parameters but rather uses the URI? In other words, /items/large instead of /items?size=large

It seems that the REST mapping only supports REST query parameters.

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

REST query URI

Post by maxkatz »

Yes, the URL would be like this: .../items/{size}. Then create 'size' input parameters for the service.

B510
Posts: 0
Joined: Wed Jun 04, 2014 2:17 pm

REST query URI

Post by B510 »

Hello Max,

Could you please advise, what should I put in URI parameters if I want to REST Query the following:

string data = "where={'$and': [{'id_users': 'john'},{'invoiceno': 'inv100'}]}";

please help

thanks a lot in advance

Yurii Orishchuk
Posts: 0
Joined: Fri Feb 14, 2014 8:20 am

REST query URI

Post by Yurii Orishchuk »

Hi B510,

You don't need to pass anything in URI when you use Appery.io REST API querying.

See details about how you should pass "where" clause in request here: http://devcenter.appery.io/documentat...

Also, if you have some problem with it, please make screen shots and describe them to be clear about your issue.

Regards.

B510
Posts: 0
Joined: Wed Jun 04, 2014 2:17 pm

REST query URI

Post by B510 »

Hello Yurii,

Thank you.. what I don't understand is where should I put the 'where' clause ( I am using C#)?

== got from the link you gave,,

curl -X GET
-H "X-Appery-Database-Id: 526fdbd8e4b07c3286b537f1"
-G
--data-urlencode 'where={"subtask": {"collName":"todo", "_id":"5278ef66e4b01085e4b79482"}}'
https://api.appery.io/rest/1/db/colle...

====

public string MakeRequestFind(string parameters)
{
var request = (HttpWebRequest)WebRequest.Create(EndPoint + parameters);
request.Headers.Add("X-Appery-Database-Id", CONST.APPERYIO_DATABASE_ID);
request.Method = Method.ToString();
request.ContentLength = 0;
request.ContentType = ContentType;
request.Accept = "/";
using (var response = (HttpWebResponse)request.GetResponse())
{
var responseValue = string.Empty;

Code: Select all

             if (response.StatusCode != HttpStatusCode.OK) 
             { 
                 var message = String.Format("Request failed. Received HTTP {0}", response.StatusCode); 
                 throw new ApplicationException(message); 
             } 

             // grab the response 
             using (var responseStream = response.GetResponseStream()) 
             { 
                 if (responseStream != null) 
                     using (var reader = new StreamReader(responseStream)) 
                     { 
                         responseValue = reader.ReadToEnd(); 
                     } 
             } 

             return responseValue; 
         }
Yurii Orishchuk
Posts: 0
Joined: Fri Feb 14, 2014 8:20 am

REST query URI

Post by Yurii Orishchuk »

{\""invoiceno\"":\""inv100\""}]}"" }

Post Reply