Can snippet C#-HTTPClient call in Console Application

Postman can convert an API request into a code snippet, such as C#-HTTPClient. We can use the generated code snippet in Web application to make calls to an API. But I’m wondering if this can be made from a C# Console Application? We need to make files upload and download to/from TitanFile site automatically. Some methods which are created from the code snippet in the console application will be called by task scheduler.

Hi @zjz-postman. Welcome to the Postman Community!

I do not write C#, so my reply is very limited. However, I believe the code generated by Postman should be runnable anywhere C# can be ran. Could you clarify on why you think it won’t work in a C# console? Have you tried running it there?

Thanks Gbadebo. I created a C# console application with serval download methods. No file has been downloaded in my local folder after running those methods.

I think you might have to take a look at the generated code properly. THe generated code gives you a good headstart to making a specific API request in a chosen language, but can at times not work right out of the box due to different reasons.

Code snippets works fine with our C# Console Application where we use the postman API snippets on Titan files download and upload.