asp.net - CRM 2016 web apis with C# -


we have crm 2016 on premise , want consume api using c# :

var credentials = new networkcredential(username, password); httpclient client = new httpclient(new httpclienthandler() {credentials = credentials}); client.baseaddress = new uri("https://xxx.elluciancrmrecruit.com/api/data/v8.0/datatel_events"); client.defaultrequestheaders.accept.add(new mediatypewithqualityheadervalue("application/json")); httpresponsemessage response = client.getasync("datatel_events?$orderby=datatel_eventname").result; if (response.issuccessstatuscode) {    var yourcustomobjects = response.content.readasstringasync(); } else {    //something has gone wrong, handle here } 

but return html page says try later instead of json response.

you should query odata endpoint information looking assuming date1_events custom entity (although naming convention seems off).

as example query contacts:

var credentials = new networkcredential(username, password); var client = new httpclient(new httpclienthandler() {credentials = credentials}) {     baseaddress = new uri("https://xxx.elluciancrmrecruit.com/api/data/v8.0/") }; client.defaultrequestheaders.accept.add(new mediatypewithqualityheadervalue("application/json")); var response = client.getasync("accounts?$top=1").result; if (response.issuccessstatuscode) {     var yourcustomobjects = response.content.readasstringasync(); } 

Comments

Popular posts from this blog

unity3d - Rotate an object to face an opposite direction -

angular - Is it possible to get native element for formControl? -

javascript - Why jQuery Select box change event is now working? -