You're almost there! Please answer a few more questions for access to the Applications content. Complete registration
Interested in joining? Complete your registration by providing Areas of Interest here. Register

C# and REST API: 401 error when setting "application/schema+json" header

Accepted answer
13
Views
3
Comments
edited Jul 2, 2018 10:19PM in Integrations and APIs 3 comments

Content

I have been working on a light wrapper for the REST API in C# and have run into a really bizarre error that I only get in C#.

Whenever I set the "Accept" header to "application/schema+json", it will work as expected if I use the base REST API URL:

https://<interfacename>.custhelp.com/services/rest/connect/v1.3/
// Works as expected

However, if I change the URL to include a resource, it will return a 401 error

https://<interfacename>.custhelp.com/services/rest/connect/v1.3/incidents
// returns a 401 error

From what I understand, in C#, you can only modify the accept header either with the HttpWebRequest or HttpClient classes.

Howdy, Stranger!

Log In

To view full details, sign in.

Register

Don't have an account? Click here to get started!