Post

1 follower Follow
0
Avatar

Using C# to connect with Podio App

We are working on creating an internal application and we want to have a vendor interface in Podio. I am using C# and I started with some code sample I found on "https://gist.github.com/2932380". I am able to connect to the application, and able to get items by item id. I have not been able to get all items.When I use the following.

RestClient client = new RestClient();

client.BaseUrl = "https://api.podio.com/";

RestRequest request = new RestRequest();

request.Resource = "/oauth/token?grant_type=app" +

"&app_id=" + APP_ID +

"&app_token=" + APP_TOKEN +

"&client_id=" + CLIENT_ID +

"&client_secret=" + CLIENT_SECRET;

request.Method = Method.POST;

request.RequestFormat = DataFormat.Json;

var response = client.Execute<OauthToken>(request);

var token = response.Data;

request = new RestRequest();

request.Method = Method.GET;

request.RequestFormat = DataFormat.Json;

request.AddParameter("oauth_token", token.access_token);

request.Resource = "/item/app/" + APP_ID +"/";

var response2 = client.Execute(request);

string content = response2.Content;

I get this responsse :

"{\"error_propagate\":false,\"error_parameters\"{},\"error_detail\":null,\"error_description\":\"Authentication as an app is not allowed for this method\",\"error\":\"forbidden\"}".

I would also like some sample code for updating items in podio using C#.

Thank you

Alejandro Carrasquilla

Alejandro Carrasquilla Answered

Please sign in to leave a comment.

3 comments

0
Avatar

Try adding another backslash to the end of your resource path, so it looks like:

request.Resource = "/item/app/" + APP_ID +"//";

RestSharp has some weirdnesses and bugs, and this is one of them. For this reason we are also looking for another .NET library that can consume REST/JSON based API's - ideas are welcome.

Casper Fabricius 0 votes
Comment actions Permalink
0
Avatar

Adding the extra / worked. to get all items.  I am also having trouble trying to add and update items. Do you have any sample code in C# where you do that?,

Thank you

Alejandro

Alejandro Carrasquilla 0 votes
Comment actions Permalink