Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Stream Read/Write Timeout causes Invalid Operation Exception

I am trying to get a request from an API using:

RestClient client = new RestClient("https://gds.eligibleapi.com/v1.5/coverage/all?api_key="
    + apiSecret + "&payer_id=" + payerID + "&service_provider_organization_name=" + 
    providerOrgName + "&provider_npi=" + NPI + "&member_id=" + ptPolicyID + 
    "&member_first_name=" + ptFirstName + "&member_last_name=" + ptLastName 
    + "&member_dob=" + ptDOB + &date=" + DOS + "&service_type=" + serviceType +
    "&format=x12");

var request = new RestRequest(Method.GET);
IRestResponse response = client.Execute(request);
string response271 = response.Content;
Stream response271Stream = StringStream.GenerateStreamFromString(response271);

I keep getting the error on the Line:

Stream response271Stream = StringStream.GenerateStreamFromString(response271)

That says:

'response271Stream.ReadTimeout' threw an exception of type System.InvalidOperationException'

And here is a picture for reference:

enter image description here

This is just one of a few calls I want to use with this API. Can anyone help me figure out why it failed upon my request to Stream the API's response? Thanks!

like image 775
Rinktacular Avatar asked Jun 21 '26 11:06

Rinktacular


1 Answers

For anyone who comes to this page, The issue was an unexpected null variable which went unhandled in the API. Without a response, the request was timing out. My fix was to first, try to allow for timeouts with my client. Once in place, I was able to narrow down issue to the data itself and there was my problem.

This answer is coming back very late, but I will try to get to questions anyone might have regarding my answer in the future.

like image 172
Rinktacular Avatar answered Jun 22 '26 23:06

Rinktacular



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!