Join 34,000+ subscribers and receive articles from our blog about software quality, testing, QA and security.
 

Accessing API v2 in C#


#1

Does anyone here have an example of how to access the new api with C#.

In particular how would test results be added through the use of C#?

Any help would be appreciated, thanks!


#2

Hello Drew,

Thanks for your posting. While there’s currently no official example for C# (yet), the API uses simple HTTP calls and you can use the WebRequest class for this, for example:

http://stackoverflow.com/questions/4015324/http-request-with-post

HTTP Basic authentication as used by the API can be added as follows:

http://stackoverflow.com/questions/707888/using-http-authentication-with-a-c-sharp-webrequest

You also need to specify the Content-Type header and this should look as follows:

I hope this helps but please let me know in case you have any further questions.

Regards,
Tobias