Is there a way to delete a featured video without actually deleting the video?
RestFB code for deleting an object is :
Boolean deleted = fbclient.deleteObject("objectId");
But facebook graph-api request for deleting a featured video is :
You can dissociate a Video from a Page by making a DELETE request to /{page_id}/featured_videos_collection.
So my question is how to dissociate the featured video using the rest fb library. Thanks in advance
You should simply make a call like this:
Boolean deleted = fbclient.deleteObject("/<pageid>/featured_videos_collection", Parameter.with("id","<pageid>"), Parameter.with("video_id","<videoid>"));
But this is untested and only according to the graph api reference ;)
Related
I'm a newbie and in progress learning to code. Currently, I'm learning to chap Retrofit & API but have meet a problem that don't have on Google,I researched 2 days ago but cannot :(
This is my all images that i uploaded in 1 album: https://imgur.com/gallery/3fEbSEz
This is all informations related to authorization that i just registered (i think so, i followed the API docs imgur):
Client Name Client ID Client Secret
Get Images Imgur e17abdfa6dd2f71 85411f4e553fd0a5aab2740ea48abe296c8370bf
Through this link: https://api.imgur.com/models/gallery_album , I tried copy paste and replace content in {} by 3fEbSEz.
Example: https://api.imgur.com/3/gallery/album/3fEbSEz/images but as you can see, it cann't access into my album and display as json file format.
I wanna see the result like this: https://jsonplaceholder.typicode.com/photos . Yupp, like this, but ... hmm, i tried many times :((
So who can help me for this case, thanks so much for all helping!!!
This is error be returned when i tried manual link
I'm using the Java botbuilder to build a microsoft teams bot. I want to add Cards to my bot (e.g. to embed links, quick replies, and images).
In the above link it says: suggested actions are not supported in Microsoft Teams: if you want buttons to appear on a Teams bot message, use a card.
However, I can find no documentation on how to add a 'card' to the Activity schema.
I tried:
1. Using suggested actions
I tried adding my List<CardAction> to the SuggestedActions
field in Activity but they were not rendered by microsoft teams
(as expected, the documentation says this is not supported).
2. Using Attachments
I suspect it could be done using attachments, but can only find
documentation for the C#/JS versions (e.g.
https://learn.microsoft.com/en-us/azure/bot-service/nodejs/bot-builder-nodejs-send-rich-cards?view=azure-bot-service-3.0).
So I want to know how to add 'a card' to Activity schema so it can be rendered by my bot.
The BotFramework Java SDK is still in preview, so there isn't a lot of documentation I can point you towards. However, here is an example of adding a HeroCard to a reply.
Activity reply = new Activity()
.withType(ActivityTypes.MESSAGE)
.withRecipient(activity.from())
.withFrom(activity.recipient())
.withAttachments(Arrays.asList(
new Attachment()
.withContentType("application/vnd.microsoft.card.hero")
.withContent(new HeroCard()
.withTitle("Hero Card")
.withSubtitle("BotFramework")
.withButtons(Arrays.asList(new CardAction()
.withValue("https://learn.microsoft.com/en-us/azure/bot-service/")
.withTitle("Get started")
.withType(ActionTypes.OPEN_URL)
))
.withImages(Collections.singletonList(new CardImage()
.withUrl("https://sec.ch9.ms/ch9/7ff5/e07cfef0-aa3b-40bb-9baa-7c9ef8ff7ff5/buildreactionbotframework_960.jpg"))))
));
You can also take a look at the SDK Attachment Tests for more examples.
Hope this helps!
I'm trying to make a MediaBrowserService. In the past when I want to display all the music files actually on the device, I would use a ContentResolver and load a cursor from the MediaStore.
I can't figure out where I am supposed to do this in a MediaBrowserService.
There is the method: onLoadChildren
The examples I find look like this:
#Override
public void onLoadChildren(
#NonNull final String parentMediaId,
#NonNull final Result<List<MediaBrowserCompat.MediaItem>> result) {
result.sendResult(MusicLibrary.getMediaItems());
}
My question is, do I use my ContentResolver cursor within this method to return a list of MediaItems? Or is there some other internal method to use to go through the device and get all the music files?
Only examples I see online are streaming services which do an HTTP call to get a song list, or they just hard code fake songs to display for testing. I'm trying to allow the service to browse music files that are on the device itself.
I also tried to do the exactly same thing in my app, hitting the same wall as you. Finally I figured out how to do it using the Android's new Paging library. You do have to use a cursor with a ContentResolver at the service side in order to fetch the media items on the device, but in order to not iterate all the cursor's records just to return the children in the onLoadChildren() method, I use the paging library to return only the chunks the user is interested in this moment at the client/UI side. You can read about it in a post I wrote, where I also demonstrate the concept with code samples.
I am using Picasa API to show user's google photos albums in my site.
I am using google's GData library. Here is my code:
PicasawebService service = new PicasawebService("MyApp");
service.setAuthSubToken("MyAccessToken");
Query query = generateQuery("https://picasaweb.google.com/data/feed/api/user/default");
query.setStringCustomParameter("kind", "album");
query.setMaxResults(1000);
UserFeed feed = service.getFeed(query, UserFeed.class);
Using this code I can see all of my albums - both old and new ones, but some users complain that they do not see all of their albums.
Any idea what can be the problem? Is it something in my code? or google photos isn't fully synced with picasa API?
Thanks.
Any idea what can be the problem? Is it something in my code? or
google photos isn't fully synced with picasa API?
It seems that this is a bug with the API. Albums created as "Shared Albums" don't appear in the API.
Steps to reproduce:
From the https://photos.google.com, click Upload and upload a picture.
In the popup shown after the image uploads, click Shared Album then New shared album and give it a name.
Confirm that the album exists at https://photos.google.com/albums and is marked as Shared.
Use the API to list your albums.
You'll find that the newly created album isn't visible via the API.
If you click Add to Album instead of Shared Album in step 2 above, the album will be visible via the API. If this unshared album is later shared, it remains visible. The problem only occurs if the album is shared when it is created.
The provided post is not working nowadays. One way to do it now is through google +.
Go to google+
Create a post and upload the photos that you want to share through picasa api and
publish the post.
Go to your home page google+ profile. In the new published post on the bottom left corner, you will see a "Show album" link, copy the link. It contains user id and album id accessible through picasa feeds.
Take into consideration that this is a hack that probably it gonna not work soon.
I have a news section where I can post some news.
-> Thumbnail , title and content
What I want:
The user should be able to upload an image file without leaving the page
-> progress bar
Send the file as a post request to my server.
Then I can get the image file from the post request, then I can resize/rename the image and upload it to amazon s3.
If I have to use a javascript library, I would prefere to use jquery.
This should looks something like this:
If I submit the news, I want to save the image path in my database. Now I would need a way to get the image name from my post method.
I've found some uploading solutions, but I have problems to understand how they are working.
http://blueimp.github.com/jQuery-File-Upload/
http://www.uploadify.com/
I only know get/post to retrieve information but they integrate somehow php files in the form.
for example:
$(function() {
$('#file_upload').uploadify({
'swf' : 'uploadify.swf',
'uploader' : 'uploadify.php'
// Put your options here
});
});
I am lacking information to do this on my own. What would you recommend me?
Ps: I am using Java with Play2
Uploadify is definitely the way to go.
All the steps for implementation are to be found here : http://www.uploadify.com/documentation/uploadify/implementing-uploadify/
You need to configure the path where your uploads go in the uploadify.php script.
As for amazon S3 here is an implementation : http://code.google.com/p/uploadify-amazon-s3/
I think onUploadSuccess method better fits than onSelect : http://www.uploadify.com/documentation/uploadify/onuploadsuccess/
You can do something like this from the documentation :
$(function() {
$("#file_upload").uploadify({
'swf' : '/uploadify/uploadify.swf',
'uploader' : '/uploadify/uploadify.php',
'onSelect' : function(file) {
alert('The file ' + file.name + ' was added to the queue.');
}
});
});
Where you can get the flename once it has been selected.
What you're asking for is a LOT really. But to get you started, have a look at this page (uses JQuery):
http://tutorialzine.com/2011/09/html5-file-upload-jquery-php/
The above link is a nice upload utility that you can use for drag-and-drop pretty easily, but it can be used by manually selecting files as well. Well documented.
As for resizing, I've used this with great success (PHP): simpleImage
simpleImage is REALLY easy to use and plug into your website.