1

I'm getting a 500 status code back in visual studio for an api shown below although when using PostMan with the same credentials I get a json response back saying the token has expired. Is this because I'm not seeing the response back as json or something? Obviously I need to handle if the token has expired so getting 500 back is not sufficient. Many thanks,

Code failing with status code 500

enter image description here

Same call but using PostMan

enter image description here

James Radford
  • 1,815
  • 4
  • 25
  • 40
  • the two calls must be different. dont second guess, use fiddler to log the requests and compare them. – wal Nov 29 '13 at 12:13
  • its the same. If you look at postman screen shot, the status is 500 as well but I'm not sure how to access the body to check the error_code – James Radford Nov 29 '13 at 12:14
  • 1
    http://stackoverflow.com/questions/11828843/webexception-how-to-get-whole-response-with-a-body – wal Nov 29 '13 at 12:18
  • yeah I was looking at that as well. It turns out its the webexception that needs to be used, rather than generic exception object. thanks, – James Radford Nov 29 '13 at 14:17

1 Answers1

0

use WebException rather than Exception.

James Radford
  • 1,815
  • 4
  • 25
  • 40