burkeholland / InstaSharp

A c# wrapper for the Instagram API
Apache License 2.0
48 stars 1 forks source link

Media ID How to get it? Please help #14

Closed RayedM closed 11 years ago

RayedM commented 11 years ago

Dear all,

I want to post comment. It requires "Media ID".

How I can obtain Media ID? Does it have to be recent one.

I tried the following code but it give me null object can you help

My code //config and info are correct InstaSharp.Endpoints.Users.Authenticated u = new InstaSharp.Endpoints.Users.Authenticated(config, info); InstaSharp.Endpoints.Comments.Authenticated c = new InstaSharp.Endpoints.Comments.Authenticated(config, info);

    InstaSharp.Model.Responses.MediasResponse res = u.Recent();

    string nextMaxId = res.Pagination.NextMaxId;

    c.Post(nextMaxId, "hello world");

//////////////////////////////////////////// Thank you

felipepessoto commented 11 years ago

First, you need a special permission from Instagram to post comments.

To get Id, use the Id property: u.Recent().First().Id