c# - "500 Internal Server Error" occur when passing the HTTP request using EA Azure Billing API -
this code applicable azure ea customers. can't able guess browser setting issue or account relates issues. checked code ea account
static void main(string[] args) { string token ="xxxx" string url = "https://ea.azure.com/rest/{portalnumber}/usage-report?month=2/5/2016&type=summary"; string = callrestapi(url,token); } static string callrestapi(string url, string token) { webrequest request = webrequest.create(url); request.headers.add("authorization", "bearer " + token); request.headers.add("api-version", "1.0"); httpwebresponse response = (httpwebresponse)request.getresponse(); streamreader reader = new streamreader (response.getresponsestream()); return reader.readtoend(); }
Comments
Post a Comment