How to use Curl with C#, windows Forms application

Asked

Viewed 874 times

3

I’m trying to integrate my desktop application with an online tool (Scrumwise), but they use Curl, I’m not able to consume the Rest.

curl https://api.scrumwise.com/service/api/v1/getData -k
  -u [email protected]:69C0A6A9E957B6398BD8C62F3B67C95005CA...
  -d "projectIDs=729-11230-1,729-31745-129"
  -d "includeProperties=Project.backlogItems,BacklogItem.tasks"

I’m having a hard time with this second line here

-u [email protected]:69C0A6A9E957B6398BD8C62F3B67C95005CA

how to transcribe this Curl in c#?

1 answer

1

You don’t exactly need to use Curl to do this. You can use Restsharp which is simpler to use:

var cookie = new CookieContainer();
var client = new RestClient("https://api.scrumwise.com/service/api/v1/getData")
{
    Authenticator = new HttpBasicAuthenticator("[email protected]", "69C0A6A9E957B6398BD8C62F3B67C95005CA"),
    CookieContainer = cookie
};

var request = new RestRequest(Method.GET);
request.AddParameter("application/x-www-form-urlencoded", "projectID=729-11230-1", ParameterType.RequestBody);
request.AddParameter("application/x-www-form-urlencoded", "name=Example backlog item 1", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);

Don’t forget that you need to generate your own Key API. This one you are testing is just example of the Scrumwise documentation.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.