box api - Search query parameter is ignored in BOX REST API -


i'm trying make call method search restsharp in vs2013. box ignoring subquery string. have consulted documentation , tested call "postman" , works well.

        string query = "asterisk";         string subquery = "file_extensions=docx";          var client = new restclient(base_url);         client.authenticator = new oauth2authorizationrequestheaderauthenticator(dev_access_token, "bearer");          var request = new restrequest(method.get);         request.resource = "search?query={query}&{subquery}";         request.addparameter("query", query, parametertype.urlsegment);         request.addparameter("subquery", subquery, parametertype.urlsegment);          request.requestformat = dataformat.json;                      var response = client.execute(request);         var content = response.content; 

regards

the problem you're adding entire file_extensions=docx string url parameter. restsharp url-encoding = , box ignoring malformed string.

get /2.0/search?query=asterisk&file_extensions%3ddocx

the following change produce correct result:

string subquery = "docx"; request.resource = "search?query={query}&file_extensions={subquery}"; request.addparameter("subquery", subquery, parametertype.urlsegment); 

get /2.0/search?query=asterisk&file_extensions=docx


Popular posts from this blog

c# - ODP.NET Oracle.ManagedDataAccess causes ORA-12537 network session end of file -

matlab - Compression and Decompression of ECG Signal using HUFFMAN ALGORITHM -

utf 8 - split utf-8 string into bytes in python -