c# - Fetching time entries from Freckle API -


i want time entries of freckle using api specific dates, either 404 - not found , when change formation of url generates 406 - not acceptable. and when want access them without using date filter works fine. uri sending date filter is:

 string dfilter = @"\ -data'search[from]=2012-07-05'"; string uri = @"https://apitest.letsfreckle.com/api/entries.xml"+dfilter; webrequest = (httpwebrequest)webrequest.create(uri); webrequest.headers.add("x-freckletoken:lx3gi6pxdjtjn57afp8c2bv1me7g89j"); webrequest.method = "get"; webresponse webresponse = webrequest.getresponse(); streamreader sr = new streamreader(webresponse.getresponsestream()); responsexml = sr.readtoend(); 

can tell me how use date filter correctly? documentation of api can found at: documentation

thanks in advance.

i think problem you're including filter in url using space , command line options part of curl command.

the documentation shows things like:

curl -g -h "[stuff]" https://apitest.letsfreckle.com/api/entries.xml \ -d 'search[from]=2009-10-10' 

there \ line continuation, , -d used pass data request. quotes keep in 1 parameter shell. -g says still use get request though, , put data in url... it's not quite you've done it. try this:

string filter = "search[from]=2012-07-05"; string uri = @"https://apitest.letsfreckle.com/api/entries.xml?" + filter; 

(also note ought use using statement webresponse , streamreader.)


Comments

Popular posts from this blog

javascript - backbone.js Collection.add() doesn't `construct` (`initialize`) an object -

php - Get uncommon values from two or more arrays -

Adding duplicate array rows in Php -