Closed biapar closed 8 years ago
@biapar Can you elaborate a bit on what you're trying to do? That would allow me to give a better answer ;)
If you're looking to implement code to support a service that is currently not supported by Skybrud.Social, you might just install the NuGet package for either Skybrud.Social
or Skybrud.Social.Core
in your project.
For reference, Skybrud.Social
is the latest stable version, currently at v0.9.4.2
. For v1.0.x
, I have done some restructuring, so that the package is now called Skybrud.Social.Core
, and only contains the core functionality. v1.0.x
is however still in beta (currently at v1.0.0-beta2
). Most of the code from the beta shouldn't change for the stable version of v1.0.0
, but I can promise anything, as I'm improving it as I'm testing and using it myself.
Feel free to find inspiration in the source code. You can find the source code for Skybrud.Social
in the v0.9-branch (which is still a single project), while the source code for Skybrud.Social.Core
is located in the master-branch. Since Skybrud.Social.Core
is just the core functionality, you can find the implementation for the individual services here: https://github.com/search?utf8=%E2%9C%93&q=user%3Aabjerner+Skybrud.Social&type=Repositories&ref=searchresults
Hi, I wish to use it to pull the media stream from Instagram, but the example are not exhaustive for this social and I wish to try if I find something into the sources. I see the new documentation here for the new version https://github.com/abjerner/Skybrud.Social.Instagram. For example, I made this code into a site, but don't work
@using Skybrud.Social.Instagram
@using Skybrud.Social.Instagram.Objects
@using Skybrud.Social.Instagram.Responses
@using Skybrud.Social.Umbraco.Instagram.PropertyEditors.OAuth
@inherits Umbraco.Web.Mvc.UmbracoTemplatePage
<section id="sliderInstagram" style="background-color:#fff;">
<div class="container myintrosection">
<div class="row">
<div class="struttura col-md-12 text-center">
<a href="https://www.instagram.com/paestumexperience/"><h3>Instagram</h3></a>
</div>
<div class="col-md-7 text-left">
<div class="container-fluid" style="padding-top: 1px;padding-bottom: 1px;">
</div>
</div>
</div>
</div>
<div class="container-fluid myintrosection">
<div class="row">
<div class="col-md-12 col-sm-12 col-xs-12">
<div id="owl-instagram" class="owl-carousel">
@{
InstagramOAuthData instagram2 = Model.Content.GetPropertyValue("instagramStream") as InstagramOAuthData;
InstagramOAuthData instagram = CurrentPage.GetPropertyValue<InstagramOAuthData>("instagramStream");
if (instagram != null && instagram.IsValid) {
InstagramService service = instagram.GetService();
InstagramUsersResponse response = service.Users.Search("paestumexperience",1);
InstagramUserSummary user = response.Body.Data.FirstOrDefault(x => x.Username == "paestumexperience");
InstagramRecentMediaResponse responseMedia = service.Users.GetRecentMedia(user.Id);
foreach (InstagramMedia media in responseMedia.Body.Data) {
<p>(@media.Link)</p>;
}
}
}
</div>
</div>
</div>
</div>
</section>
where the instagramStream refer a field of type Skybrud.Social.Instagram.OAuth into a document type.
Which solution Do I use if I want develop some function on this project? For example. Do I need only the Instagram solution if I wish develop or extend it?
Thx.
Hi again,
If you only want to work with stable code, you can pull down the v0.9-branch. This will contain a Visual Studio solution named Skybrud.Social
, which holds a project of the same name. The project has an Instagram
folder with the implementation for the Instagram API. You can see it on GitHub here: https://github.com/abjerner/Skybrud.Social/tree/v0.9.x/src/Skybrud.Social/Instagram
Like I wrote earlier, v1.0
is still under development. If you're totally okay with this, you can play around with Skybrud.Social.Instagram instead. It's the most updated code I have for Instagram ;)
Anyways, the website may lack examples for some of the methods already supported by the Instagram implementation, so if you have a link to the Instagram documentation for the API method you wish to use, I can tell whether it is supported by my code.
@abjerner Is the v1.0 version of the SkyBrud.Social.Twitter
package on NuGet?
(I can find the SkyBrud.Social.Core
package if I check "Include Prerelease" but there is no mention of the Twitter package.)
@biapar I've missed your code example since it seems you edited your post after my last reply (I will receive notifications for new comments). The Umbraco package is build against the stable version of Skybrud.Social, so you should have a look at the v0.9-branch as I mentioned in my last reply.
You write that the code doesn't work. How does it not work? Do you get an exception, or does the call to the API simply not return any media? From what I can tell, your code example seems to works fine, so it's probably an issue with either the settings of your Instagram app, or a missing scope (which the Umbraco package doesn't support yet). If that's the case, you should probably have a look at this repository instead.
@adaam2 I haven't really focused that much on the Twitter implementation for v1 yet, so unfortunately no. For now, I would recommend using v0.9.4.2 (which also contains the Twitter implementation).
Hi, I've any error and any media. I create keys in Instagram and putted into datatype and after I logged in Instagram from Umbraco backend.
@biapar I'm not sure I understood your last comment. Do you get any exceptions? What about media?
Hi, with media, I mean the media stream of Instagram. With datatype the Skybrud.Social Instagram datatype ( see image above ). Bye.
@biapar Maybe we're just talking past each other, but I'm still not sure whether you get an exception or not.
Anyways, if you can give me some more information about your setup, I might be able to help. For instance, which Instagram user did you use for authentication in Umbraco? Is it paestumexperience
? Does your Instagram app run in sandbox mode?
If you have authenticated with another user, and your app is running in sandbox mode, you won't be able to get information or media from other users. You probably also need the public_content
scope, which - if you're not running in sandbox mode - will require approval from Instagram. The Umbraco package currently doesn't support specifying a scope during login. You can read more about this in the Instagram API documentation: https://www.instagram.com/developer/sandbox/
You could also try calling the API directly via your browser. In your code, you make a request to get information about the paestumexperience
user. This equals to calling https://api.instagram.com/v1/users/search?q=paestumexperience&access_token=ACCESS_TOKEN
. What does the server return? If successful, you should get a JSON response where the data
property is an array with one or more users.
Hi, the app is in sandbox mode and the keys API are mine, but the stream is the media of other user.
@biapar Then that's the reason. As your app is running in sandbox mode, you won't be able to fetch information (or just search for) other users.
So for this to work, you need to deactivate sandbox mode, and authenticate with the public_content
scope. This scope is currently not supported by my Umbraco package (it is by Skybrud.Social), and it also requires approval from Instagram. If your app is approved for use of the public_content
scope, then you will be able to search for paestumexperience
and fetch the most recent media of the user.
If you're working with paestumexperience
, an alternative could be to add them as a sandbox user while still in sandbox mode. You can send them a sandbox user invite for your app via the Instagram developer section. Then they will be able to see and accept the invite in the developer section as well (they wont receive any notifications).
I can really recommend reading the Instagram documentation, since I won't be able to (or have to time to) full cover the API in my own documentation.
Thank you for your support. I'll try. So, I cannot to uso Skybrud.Social with public_content. Is't right?
@biapar Yes and no. If we look at Skybrud.Social
separately, it now does support the public_content
scope in the newest stable release.
However if we look at Skybrud.Social.Umbraco
(which is the Umbraco package/integration), it doesn't support specifying a scope at the moment. I will see whether I can do a new release of the Umbraco package tomorrow. I have already updated the UI to allow specifying the scope (int the latest code here on GitHub):
@biapar I needed to do some testing before releasing, which I first had time to do today. I have now pushed a new release of Skybrud.Social.Umbraco
, which supports selection the scope for the OAuth authentication:
https://github.com/abjerner/Skybrud.Social.Umbraco/releases/tag/v1.0.4
You will however still need to deactivate sandbox mode in your Instagram app and get approval from Instagram to use the public_content
scope. Otherwise you won't be able to fetch media from other users - eg. paestumexperience
.
Hi,
Is there a guide to setup Visual Studio solution to devel plugin like Instagram because there is a solution for each module. It's possible to create a big solution with sub projects?