How to use Curl with C #, application windows forms

3

I'm trying to integrate my desktop application with an online tool (ScrumWise), however 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 on this second line here

-u [email protected]:69C0A6A9E957B6398BD8C62F3B67C95005CA

How to transcribe this Curl in C #?

    
asked by anonymous 19.05.2017 / 17:09

1 answer

1

You do not 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);

Do not forget that you need to generate your own API Key. The one you're testing is just the example of ScrumWise documentation .

    
19.05.2017 / 18:35