Created
June 14, 2012 19:26
-
-
Save RSpace/2932380 to your computer and use it in GitHub Desktop.
Podio app auth + read item example (Restsharp reference required)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using RestSharp; | |
using RestSharp.Deserializers; | |
namespace Podio | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
var client = new RestClient(); | |
client.BaseUrl = "https://api.podio.com/"; | |
var request = new RestRequest(); | |
request.Resource = "/oauth/token?grant_type=app&app_id=XXXXX&app_token=XXXXX&client_id=XXXXX&client_secret=XXXXX"; | |
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/XXXXX"; | |
var response2 = client.Execute(request); | |
Console.WriteLine(response2.Content); | |
Console.ReadKey(); | |
} | |
} | |
class OauthToken | |
{ | |
public string access_token { get; set; } | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
👍