1

I'm trying to write a .net console application in c# that will execute (via a windows scheduled task) nightly and do a number of admin things (moving files around and so on). I want it to then report its status (good/bad/in-between) to a circuit chat.

I'm lost as to how to do this circuit reporting step. What visual studio extensions/apis (if any) exist to help with this? I've read up on the rest API, the node.js one etc, but I'm not sure how to use these from my console app.

Any pointers or ideally examples on this would be much appreciated.

Thanks in advance.

1 Answers1

0

We have a .NET client in alpha. Reply to the email you got for your OAuth app registration and mention you'd like to try out the .NET alpha version. If you haven't registered for a OAuth app, then please do so as you will need that independent of which Circuit API you'll use. See instructions at https://circuit.github.io/.

But if all you want to do is to send a message in a conversation, then the better option is to use the REST API.See endpoint /conversations/{convId}/messages at https://circuitsandbox.net/rest/v2/swagger/ui/index.html. You can then make a REST API call in .NET using HttpClient. Something like this https://learn.microsoft.com/en-us/dotnet/csharp/tutorials/console-webapiclient.

Roger Urscheler
  • 774
  • 2
  • 6
  • 11
  • Hi @Roger-Urscheler, Thanks for the response. I've used your examples to successfully communicate between my c# console app and the CircuitSandbox using REST! However... when I point my console app at the REST url of my company chat I receive the following error: “{"errorDescription":"n/a","errorCode":"501"}” Googling this suggests that my company's Circuit does not have REST access enabled. Is this likely to be the case? and is there any help documentation re how to switch on REST access? Thanks again in advance – Gordon Doherty Dec 10 '18 at 16:04
  • Are you trying to move your app from the sandbox to a Circuit production tenant from your company? If thats the case you need to get new credentials for the production system. Please follow the instructions at https://circuit.github.io/ If I miss-understood, please try to explain what you are trying to do. – Roger Urscheler Dec 12 '18 at 13:10
  • My console app is running on my laptop (not on the sandbox or anything). All I'm trying to do is point it at http://mycompanycircuit.net/resturl (instead of https://circuitsandbox.net/resturl) In doing so I'm also supplying my company domain credentials (the credentials I use to log into Outlook and Circuit as a normal user), but this is resulting in the 501 error – Gordon Doherty Dec 12 '18 at 14:54
  • Hi Gordon, if you are on a sandbox and you are admin of it, two steps : 1) go to the menu under your name > settings > circuit labs and enable the Oauth Apps. 2) go to the Adminisration menu > Oauth Apps and create your application (use Authorization code as grant type I think if you are making a server side REST API application) – samo Dec 13 '18 at 14:13