How to use FRED Rest service with c# -


i try use fred hammock use provided rest service. unfortunately have no idea how use it. did far:

string url = "http://wit.istc.cnr.it/stlab-tools/fred/api"; hammock.restclient client = new hammock.restclient(); client.addheader("accept", "image/png -f text=miles davis american jazz musician"); //client.addheader("accept", "text=miles davis american jazz musician"); client.authority = url; hammock.restrequest req = new hammock.restrequest(); req.path = url; hammock.restresponse response = client.request(req); string _result = client.request(req).content; 

you're making post request never specify that.


from juniper.net, extract make post request:

public void makeqrest() {     try {         string auth = "http://wit.istc.cnr.it/stlab-tools/fred/api";         string body = "text=miles davis american jazz musician";         iwebcredentials credentials = new hammock.authentication.basic.basicauthcredentials {             username = config.uname,             password = config.pword         };          restclient client = new restclient {             authority = auth,         };         client.addheader("content-type", "accept: image/png");          restrequest request = new restrequest {             credentials = credentials,             method = webmethod.post         };         request.addpostcontent(encoding.utf8.getbytes(body));          restresponse response = client.request(request);         console.writeline("the create queue status " + response.statuscode);         console.writeline(response.content);         console.readline();     } catch (exception e) {         console.writeline(e.message);         console.readline();     } } 

the method = webmethod.post part first missing thing in code.


Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -