Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

[RELEASED] Instagram API (Object oriented, event based...)

Discussion in 'Assets and Asset Store' started by bdovaz, Jan 2, 2016.

  1. bdovaz

    bdovaz

    Joined:
    Dec 10, 2011
    Posts:
    1,042

    Asset Store link

    https://assetstore.unity.com/packages/tools/integration/instagram-api-52968

    Online documentation

    https://docs.google.com/document/d/1ud8F2Q_YKHOqxOn5bxgUIuXOixs4muwFfus6uRaW1ws

    Online example

    https://dl.dropboxusercontent.com/s/wwhxhsznykfzzbt/index.html

    Supported Platforms

    • Android support. No UnityPlayerActivity inheritance (no other third party plugin compatibility problems).
    • iOS support.
    • WebGL support (GET requests by default, CORS/JSONP limitation but can be workarounded with a simple PHP proxy script that it’s included to support POST/DELETE calls).
    • Windows/Mac support. Implemented using uWebKit (so it requires it).
    Features
    • Full object oriented API (you don’t deserialize anything, it’s already done it for you)
    • Documentation available.
    • Easy integration to your Unity project.
    • Well organized and structured code.
    • Event based. Example: OnUserSearchRetrieved(User[] users), OnMediaSearchRetrieved(Media[] media)
    • Debug mode (in editor):
      • You can test all API with no publication requiring.
      • You can log Instagram original endpoint url and JSON response.
    • Examples available. Includes an example to test the full API with a console view.
    • Requires Unity 5.3+ (by default uses JsonUtility and UnityWebRequest) but you can make it 5.0, 5.1, 5.2 backwards compatible implementing:
      • IJsonSerializer: Interface to deserialize Json data. You can use JSON .NET that is backwards compatible.
      • IRequest: Interface to make requests. You can use Best HTTP that is backwards compatible.


     
    Last edited: Apr 3, 2020
  2. bdovaz

    bdovaz

    Joined:
    Dec 10, 2011
    Posts:
    1,042
    Bump! It has been approved!
     
  3. luks0r

    luks0r

    Joined:
    Apr 7, 2015
    Posts:
    2
    This looks great but with no reviews up yet I'm a bit hesitant in case this is my quite what I'm looking for. Do you have a trial version available with limited functionality that can be checked out? Thanks!
     
  4. bdovaz

    bdovaz

    Joined:
    Dec 10, 2011
    Posts:
    1,042
    You have:

    - A public WebGL demo.
    - A public Google drive document with all the documentation.

    Read the asset store page information to see if it's what you need and feel free to ask any questions.

    I have sales but they didn't review anything and I don't know who are those people (you can't see or contact your customers) to suggest to review my package.
     
  5. danreesthomas

    danreesthomas

    Joined:
    Dec 15, 2015
    Posts:
    2
    Hi, will this plugin allow an app to upload an image (from texture2D or otherwise) to the account signed in? I've looked through the documentation and failed to see anything that indicates uploading. Also the WebGL example loading bar fills up then hangs for me with no errors.
    Thanks.
     
  6. bdovaz

    bdovaz

    Joined:
    Dec 10, 2011
    Posts:
    1,042
    It can't do it because Instagram doesn't allow it.

    https://www.quora.com/Why-doesnt-In...applications-to-upload-photos-through-its-API

    I can't do it if Instagram API doesn't have an endpoint to do that, sorry.
     
  7. Nico20003

    Nico20003

    Joined:
    Apr 4, 2014
    Posts:
    35
    When I try to use the demo I get:
    {"code": 403, "error_type": "OAuthForbiddenException", "error_message": "You are not a sandbox user of this client"}
     
  8. siddharth3322

    siddharth3322

    Joined:
    Nov 29, 2013
    Posts:
    1,049
    Hi, I have interested in purchase of this plugin. But I want my questions reply.

    - Can I access and download images uploaded over my account?
    - Does this plugin contains login facility?
    - If no then via other way if I provide login functionality and then access other details via this plugin then will it work?
    - Can I upload my images over my account?

    Please reply for me, I am curiously waiting for your side reply.
     
    Last edited: May 26, 2016
  9. bdovaz

    bdovaz

    Joined:
    Dec 10, 2011
    Posts:
    1,042
    My asset it's a copy of the Instagram API. It has implemented all endpoints available. See the asset docs.

    1. You have:

    public void GetUserRecentMedia();
    public void GetUserRecentMedia(string id);

    2 and 3. Yes, on WebGL it's done by the browser redirecting it to your app on success (as seen in the asset example). On Android and iOS it's implemented by a basic native web browser.

    4. No because it's not supported officially by Instagram, it has to be done with Android Intents or iOS Hooks and you need the Instagram app installed on your device (that's why I have not implemented it):

    https://www.instagram.com/developer/mobile-sharing/

    If you have any other questions feel free to ask.

    Thanks.
     
  10. siddharth3322

    siddharth3322

    Joined:
    Nov 29, 2013
    Posts:
    1,049
    @N3uRo Thanks for your reply :)

    - Can I able to do login via this plugin? Because it become easy for me to move ahead in this.
    - Can I able to download images uploaded into my Instagram account?
    - If I want to display all Instagram account images into my application then what is the best way?
    Whether I need to create custom UI to display these images? Or Instagram provide some in build UI?

    I know I have asked somewhat my personal questions but if you share some of your suggestions with me then my way become clear and easy :)
     
  11. siddharth3322

    siddharth3322

    Joined:
    Nov 29, 2013
    Posts:
    1,049
    @N3uRo Can you provide me any iOS build for test?
    Because my working platform is iOS and WebGL build I can't able to load in browser.
     
  12. bdovaz

    bdovaz

    Joined:
    Dec 10, 2011
    Posts:
    1,042
    1. I already answered that on my previous answer and the answer is yes.

    2. Of course, you have a "Media" class that stores all this information: "low_res", "standard_res" and "thumbnail" images paths (along with much more information).

    3. Instagram and this assets it's only be able to provide you the data model, the UI interface it's up to you.

    There is a public WebGL example. If you have more questions, feel free to ask.
     
  13. siddharth3322

    siddharth3322

    Joined:
    Nov 29, 2013
    Posts:
    1,049
    @N3uRo Please reply me for my following questions:

    - How can I run WebGL demo?
    I loaded your example in browser but it got stuck at this point.

    Screen Shot 2016-05-30 at 2.05.49 PM.png

    - May I upload images to my Instagram account using this plugin?
    - May I upload images to my custom server using this plugin by download it from Instagram account?
    - What about login screen provided by plugin? Means it will load login dialog provided by Instagram by default as like Facebook login dialog or I need to create my custom login dialog to provide user interface!!

    Sorry for my too many questions but I was near to clear all my doubts.
     
  14. bdovaz

    bdovaz

    Joined:
    Dec 10, 2011
    Posts:
    1,042
    1. On Unity WebGL supported browsers should work. It hangs a bit at 100% but a seconds/minute later, should response.

    2 and 3. I already answered that on a my first answer on our conversation, read it, please (it's my 4th answer).

    4. Yes but in some platforms it's with a WebView embeded in Unity because Unity doesn't provide a WebBrowser. Anyway, the user will see the official Instagram login page.
     
  15. siddharth3322

    siddharth3322

    Joined:
    Nov 29, 2013
    Posts:
    1,049
    @N3uRo Thanks for your reply.

    At least now I can able to run demo in browser. But when I try to login, I am getting this as output.

    Screen Shot 2016-05-30 at 10.51.08 PM.png
    - How to come across from this? So that I can test full available things.

    My last question to you before purchase,

    Before few post, I asked this question to you, "- Can I upload my images over my account?"

    You replied me this, "No because it's not supported officially by Instagram, it has to be done with Android Intents or iOS Hooks and you need the Instagram app installed on your device (that's why I have not implemented it):"

    - What if I want to upload at my custom web server, downloaded images from Instagram account. Does this thing become possible?
     
  16. siddharth3322

    siddharth3322

    Joined:
    Nov 29, 2013
    Posts:
    1,049
    @N3uRo Please reply me for above questions, Just waiting for your reply.
     
  17. bdovaz

    bdovaz

    Joined:
    Dec 10, 2011
    Posts:
    1,042
    I need to update the webgl example so anyone can test with it's own accounts.

    With the API you can only download media, not upload it to your instagram account.

    If you want to upload your downloaded media to other place other than Instagram it's up to you because that does nothing to do with my asset, it's your own code.
     
  18. siddharth3322

    siddharth3322

    Joined:
    Nov 29, 2013
    Posts:
    1,049
    @N3uRo tomorrow morning I will purchase this plugin :)

    Thanks for your awesome replies. I hope you will help in future too :)

    After using this plugin as per my requirement, I will give you awesome rating and reviews too.
     
  19. bdovaz

    bdovaz

    Joined:
    Dec 10, 2011
    Posts:
    1,042
    Ok, thanks. You can keep asking the questions you want related to this asset.
     
  20. Verdo

    Verdo

    Joined:
    Jul 23, 2015
    Posts:
    9
    Hey there. I wanted to try implementing something within my app, and i'd like to know if this asset you've created would be able to do it.

    I wanted to create a button in my game where when pushed, it took a screenshot of the gameplay, and then once the match is over, i wanted the player to be shown the shots they took and be able to take that screenshot (or multiple screenshots) and upload it to their instagram account. I wanted to know if your asset would be able to do this and if so, could you give me a brief, step-wise process of how I'd do it? Thanks
     
  21. siddharth3322

    siddharth3322

    Joined:
    Nov 29, 2013
    Posts:
    1,049
    @N3uRo Now I have purchased this plugin. Just my initial look up to this plugin, I have this question in mind.

    I need to do this process for which purpose?

    Screen Shot 2016-06-05 at 2.25.46 PM.png
     
  22. bdovaz

    bdovaz

    Joined:
    Dec 10, 2011
    Posts:
    1,042
    I've already answered that many times. Instagram doesn't allow any third party application to upload contents to any Instagram account. It needs to be done with it's official app.

    The only way to is this but it requires to have the official app installed as it's interacts with it:

    https://www.instagram.com/developer/mobile-sharing/

    You need to do that in order to be able to use the Instagram API.
     
  23. siddharth3322

    siddharth3322

    Joined:
    Nov 29, 2013
    Posts:
    1,049
    @N3uRo Thanks for your quick reply.
    Now how to deal with this?

    Screen Shot 2016-06-05 at 2.43.45 PM.png

    In code, I have written this,
    Code (CSharp):
    1. public class InstagramAPIController : MonoBehaviour
    2. {
    3.     void Start ()
    4.     {
    5.         InstagramAPI.Instance.Auth ("https://www.instagram.com/developer/clients/manage/", new string[] { "SUCCESS", "FAIL" });
    6.     }
    7. }
    At present, I can able to manage accessToken via external resource and paste it into text box. But how to do this by plugin only?
     
    Last edited: Jun 5, 2016
  24. siddharth3322

    siddharth3322

    Joined:
    Nov 29, 2013
    Posts:
    1,049
    @N3uRo Now I am getting all my personal information in JSON response.
    I want to display my profile photo in my application. Whether I need to access it manually or any other in built way exist to perform this??
     
  25. siddharth3322

    siddharth3322

    Joined:
    Nov 29, 2013
    Posts:
    1,049
    @N3uRo One more question, I add into sequence so that you can answer this too in one time. If I create iOS build and send it to other person then they have same functionality as I am getting in iPhone?

    Whether I need to do anything else then please let me know about it.
     
  26. bdovaz

    bdovaz

    Joined:
    Dec 10, 2011
    Posts:
    1,042
    Read the message given by the error. You need to grab the access_token value and paste it in the InstagramSettings.asset. This it's only for Unity Editor in order to debug and test the API. When you release it (android/ios, etc...) you don't need this.

    The first parameter of "Auth" method it's a redirect token. Depending of which platforms are you targeting it's important what you put in there. In the case of WebGL it will be the url that will be redirected on a successful login. On other platform it can be any valid url (it's only used to do a compare and close WebView automatically on successful login).

    The second parameter it's the "scopes". Read the official Instagram API documentation on "scopes" please:

    https://www.instagram.com/developer/authorization/
     
  27. bdovaz

    bdovaz

    Joined:
    Dec 10, 2011
    Posts:
    1,042
    You need to access it an load it with WWW or UnityWebRequest on your own.

    I said it earlier, this asset only provides Instagram API access.

    Yes but be careful with Sandbox mode:

    https://www.instagram.com/developer/sandbox/
     
  28. siddharth3322

    siddharth3322

    Joined:
    Nov 29, 2013
    Posts:
    1,049
    Now I go through full Instagram documentation, available here:

    https://www.instagram.com/developer/
    • When I go through several thing at that time I am getting following kind of dialog box. What is usage of this dialog box? What I need to do several details its asking for? Like latitude, longitude, query etc...
    IMG_0033.jpg

    Please reply my questions because in success of my current work, your side help is really needed.
     

    Attached Files:

    Last edited: Jun 7, 2016
  29. siddharth3322

    siddharth3322

    Joined:
    Nov 29, 2013
    Posts:
    1,049
    My other question to you,
    Why are you adding count parameter in media access url?

    I am talking about this statement:
    Code (CSharp):
    1. InstagramAPI.Instance.GetUserRecentMedia ();
    I have tested plugin url in browser and getting following output:
    Screen Shot 2016-06-07 at 9.27.14 PM.png
    I have tested link provided by Instagram API section and getting following output:
    Screen Shot 2016-06-07 at 9.10.16 PM.png Now you need to reply back to me for my above question. I need to modify code into your plugin or not!!!
     
  30. siddharth3322

    siddharth3322

    Joined:
    Nov 29, 2013
    Posts:
    1,049
    @N3uRo Why are you not replying me? I already purchase this plugin so you need to give me some support.
     
  31. bdovaz

    bdovaz

    Joined:
    Dec 10, 2011
    Posts:
    1,042
    This dialog it's for testing purposes. There are many endpoints that have required or optional parameters. Read the official documentation.
     
  32. bdovaz

    bdovaz

    Joined:
    Dec 10, 2011
    Posts:
    1,042
    I don't understand the difference between the two requests. The only difference I saw it's "count=-1". I have tested a request sending "count=-1" or not sending it and the response it's ok.

    The only thing I can't see it's if your access_token it's the same or different in both requests.
     
  33. bdovaz

    bdovaz

    Joined:
    Dec 10, 2011
    Posts:
    1,042
    I have been out all the week for work-related reasons.

    I have my life and my work, I can't be here all the time and buying my asset doesn't give you the right of having a response one second later. I'll answer as soon as possible.

    I think I have been answering all your questions even though much of them aren't related to my asset, they are related to not reading or understanding official Instagram API endpoints documentation.
     
    TankThunderbird likes this.
  34. magi

    magi

    Joined:
    Dec 4, 2013
    Posts:
    1
    How can signout for another account login?
     
  35. bdovaz

    bdovaz

    Joined:
    Dec 10, 2011
    Posts:
    1,042
    I'm on vacations so I can't do anything but If I remember correctly, the 'logged' user it's only an access token that it's stored so you only need to empty that variable and login again.
     
  36. Mukabr

    Mukabr

    Joined:
    Jun 10, 2013
    Posts:
    61
    Hi @N3uRo,

    First of all, i'd like to thank you for this awesome asset.
    Secondly, i'd like to ask how to get more photos from the logged user.

    I'm getting the first 20 images fine, but I have no idea how to get more 20 images starting from the last i got before.
    I tryied saving the image.id in a string and calling InstagramAPI.Instance.GetUserRecentMedia(lastID, 20); but this doesn't seem to work.

    Thank you!

    EDIT: Ok, I get it. I'm in Sand Box mode....
     
    Last edited: Jul 31, 2016
  37. bdovaz

    bdovaz

    Joined:
    Dec 10, 2011
    Posts:
    1,042
    Yes, be careful with that. If you don't know it it's really confusing and you waste much time with that.

    That's why there is a special section in my asset documentation.

    https://www.instagram.com/developer/sandbox/

     
  38. Sollare

    Sollare

    Joined:
    Feb 14, 2012
    Posts:
    6
    @N3uRo,

    Hello there! Im looking for instagram plugin to share photos from the Windows app.
    You saying, that it requires uWebKit, but its discontinued right now, and i dont understand - i still can use your plugin + previous versions of uWebKit (where i can get it?), or now it is impossible?

    Thanks for answers!
     
  39. bdovaz

    bdovaz

    Joined:
    Dec 10, 2011
    Posts:
    1,042
    Yes, sadly uWebKit it's discontinued (I think that contacting the developer you can obtain a license for the last version). There are alternatives but since I don't have a license I can't support it (though it shouldn't be difficult):

    https://www.assetstore.unity3d.com/en/#!/content/55459

    https://www.assetstore.unity3d.com/en/#!/content/67713

    But you should now that with Instagram official API you can't post photos, it isn't allowed:

    https://www.instagram.com/developer/endpoints/
     
  40. Sollare

    Sollare

    Joined:
    Feb 14, 2012
    Posts:
    6
    Ive just contacted with the uWebKit developers - unfortunately they doesnt sell it anymore :(
    Thanks for help!
     
  41. bdovaz

    bdovaz

    Joined:
    Dec 10, 2011
    Posts:
    1,042
    You have the two alternatives I mentioned, it shouldn't be difficult to integrate them but since I haven't purchased those assets I can't do anything with that besides helping you with some doubts.
     
  42. graydetroit

    graydetroit

    Joined:
    May 11, 2016
    Posts:
    1
    @N3uRo, I just purchased this plugin, thanks a lot for making this available. I would like to use a webview for a Windows-platform-only scenario. My use case is for a VR experience that would allow users to login to instagram and view photos in VR, so it would need to work on Windows only -- was wondering if something like this would work:

    https://github.com/bkeiren/AwesomiumUnity

    Seems like your asset requires the uWebKit specifically, I wonder if I have to do a bunch of modification to your asset or something in order to have it work with Awesomium.

    Thanks in advance!
     
  43. bdovaz

    bdovaz

    Joined:
    Dec 10, 2011
    Posts:
    1,042
    There is no Unity built-in web browser API so for each platform we have to implement it specifically or use another existing asset. In the specific case of standalone platforms I used uWebKit because at that moment was the "best" choice.

    Now that it's discontinued there is in the asset store another good option (apparently):

    https://www.assetstore.unity3d.com/en/#!/content/55459

    My problem is that I don't have a license yet (same case as Awesomium).

    Despite this it should be easy to implement it for another asset if this asset provides the specific API that we need (know when url changes). If you want to try to integrate it in your choice (in this case Awesomium) you need to look to "UWebKitInsta.cs" that has less than 100 lines of code.
     
  44. kyriakosPet

    kyriakosPet

    Joined:
    Dec 7, 2016
    Posts:
    1
    Hi and congratulations for the nice asset.
    Can you please give me more informations about how the pagination works ?
    For example how I can get all the photos of a user.
    I know that I am in sndbox and I can get only 20 but what is the logic to achieve that ?

    Thank you
     
  45. bdovaz

    bdovaz

    Joined:
    Dec 10, 2011
    Posts:
    1,042
    You should do it with GetUserRecentMedia method, you have an overload with one parameter that is the result count you want.

    Pagination it's handled automatically for you.
     
  46. cms

    cms

    Joined:
    Sep 19, 2011
    Posts:
    43
    Hello.
    Thanks for the plugin, I need it for android and iOS. I have some questions.
    • The 'auth' makes the appli to open a browser. Is it possible to close the browser window automatically and return to the application ?
    • The unity editor requires copy/paste the token from the browser. I compile for android, and after pressing "Auth" nothing happens.. any idea ?
    Thanks in advance for your reply
     
  47. bdovaz

    bdovaz

    Joined:
    Dec 10, 2011
    Posts:
    1,042
    Are you saying that it's not doing it? It should because both plugins (Android / iOS) "listen" to url changes to automatically close it.

    The token you copy and paste it's only for editor, not for Android.
     
  48. SoWhatWeed

    SoWhatWeed

    Joined:
    Oct 23, 2016
    Posts:
    2
    Hi!
    Please infom me, how to solve this :

    Error: Instagram.Response -> Type: OAuthPermissionsException Code: 400 Message: This client has not been approved to access this resource.

    Hope for soon contact, bye.
     
  49. bdovaz

    bdovaz

    Joined:
    Dec 10, 2011
    Posts:
    1,042
    You need to request the correct permission:

    https://stackoverflow.com/a/41759078
     
  50. SoWhatWeed

    SoWhatWeed

    Joined:
    Oct 23, 2016
    Posts:
    2