Unable to consume OpenShift REST API in C#.net -


i want know how can consume openshift rest api c#.net based application. have gone through url https://access.redhat.com/documentation/en-us/openshift_online/2.0/pdf/rest_api_guide/openshift_online-2.0-rest_api_guide-en-us.pdf, in there mentioned example ruby, python , crul. not mentioned .net. have created sample application consuming api. below code -

string url = "https://openshift.redhat.com/broker/rest/api"; httpwebrequest request = (httpwebrequest)webrequest.create(url); request.method = "get"; request.contenttype = "application/xml;";  try         {             webresponse webresponse = request.getresponse();             stream webstream = webresponse.getresponsestream();             streamreader responsereader = new streamreader(webstream);             string response = responsereader.readtoend();             console.out.writeline(response);             responsereader.close();         }         catch (exception e)         {             console.out.writeline("-----------------");             console.out.writeline(e.message);         } 

while executing above code getting following error - "the remote server returned error: (406) not acceptable."

please let me doing wrong. in advance jyoti

you using wrong http header. contenttype used post/put operations tell server expect. when resource must specify accept header.

request.accept = "application/xml"; 

Comments

Popular posts from this blog

java - Oracle EBS .ClassNotFoundException: oracle.apps.fnd.formsClient.FormsLauncher.class ERROR -

c# - how to use buttonedit in devexpress gridcontrol -

nvd3.js - angularjs-nvd3-directives setting color in legend as well as in chart elements -