2012-10-18 40 views
3

我跟着這個鏈接OAuth 2.0 In .NET With Instagram API,它幫助我解決了我的問題,獲取我的訪問令牌。

我的代碼是這樣的:用c#在instagram中創建訂閱

NameValueCollection parameters = new NameValueCollection 
              { 
               {"client_id", ClientId}, 
               {"client_secret", ClientSecretId}, 
               {"object", "user"}, 
               {"aspect", "media"}, 
               {"verify_token", "thisIsANormalSubscription"}, 
               {"callback_url", CallbackURI} 
              }; 

     WebClient client = new WebClient(); 
     var result = client.UploadValues(SubscriptionURI, parameters); 

SubscriptionURI = 「https://api.instagram.com/v1/subscriptions」。

我正在關注來自instagram(http://instagram.com/developer/realtime/)的指南,其中包括POST請求的所有參數。但是,當它執行client.UploadValues時,我只會得到400錯誤。

PS:這是我的第一篇文章,所以可能不那麼吸引人的眼球,我都希望

+0

我還沒有理解這個問題。你想做什麼?問題是什麼? – gsscoder

+0

我結束了使用jQuery/ajax。 類似於此[嘗試訪問使用jquery instagram api](http://stackoverflow.com/questions/11712106/trying-to-access-instagram-api-using-jquery) –

+0

@dead問題是,我得到我上傳值時出現400錯誤 –

回答

0

,如果你有你的訪問令牌,你可以使用這個插件,我發現,它得到的最新照片來自用戶。

Instagram .NET

+0

該網站現在已關閉?它只顯示400錯誤消息atm –

+0

您可以訪問插件[這裏](http://codecanyon.net/item/instagram-net/5396378?WT.ac=category_item&WT.seg_1=category_item&WT.z_author=dego89)...我會研究爲什麼該網站是關閉的 – Mike

+0

它仍然不回答我的問題壽,只能繞過它與插件。 –

0

如果您正在使用的客戶端Instasharp API(https://github.com/InstaSharp/InstaSharp),你可以做這樣的事情:

public InstagramConfig Config 
    { 
     get 
     { 
      return new InstagramConfig(InstagramAuthorisationModel.ApplicationId, InstagramAuthorisationModel.Secret); 
     } 
    } 

public void YourSubscribeMethod(string searchTerm) 
{ 
    var result = await new Subscription(Config).CreateTag(searchTerm)) 
} 

其中InstagramAuthorisationModel是保存您註冊的應用程序ID和祕密 你一個類可以創建地理,(CreateGeography),用戶(CreateUser)和(CreateLocation)方法的訂閱。