Retrieve unpublished videos on Dailymotion API - php

I'm trying to retrieve the unpublished videos I have on my DM account, i.e. the videos I've uploaded to DM but are not yet public. I'm using the PHP SDK v1.6.3 and I'm quite a beginner with the Dailymotion API.
I assume (but I'm not 100% sure) that I have to use the private filter as documented here
I've tried
$api->get('/me/videos',array('filters' => array('private')));
which raises a DailymotionApiException exception with the following message
Unrecognized value (private), allowed values are (featured, hd,
official, creative, creative-official, ugc, buzz, buzz-premium, 3d,
live, live-offair, game, all-live, live-upcoming, no-live, premium,
premium-paidvideos, premium-offers, no-premium, history, with-poster,
without-poster, promoted-on-games) at index #0 for `filters' parameter
which is strange because from this doc, 'private' is a valid filter for videos.
I've also tried
$api->get('/me/videos',array('filters' => array('private' => true)));
which apparently has a wrong format as it also raises a DailymotionApiException exception
Invalid type (array required, dict given) for `filters' parameter
Is there something wrong with the way I use filters in the PHP SDK ?

There are 2 mistakes in what you do:
first, "private" is different from "unpublished"
they way you call the filters is not the right one.
1) A private video is only viewable by you on dailymotion as it does not appear on your channel page. You can share it with other users by sharing the private permalink that you can retrieve using the url field.
An unpublished video is only viewable by you and can't be shared. It should be used when you edit the video (description, title, etc) before publishing it.
2) Now, about the way you call the PHP SDK:
private is a filter by itself, you don't need to add the filters parameter. The filters filter is deprecated (see https://developer.dailymotion.com/documentation#video-filters-filter).
Your call has to be using either of: flags=private or: private filter.
With the PHP SDK, you could use:
$result = $api->get('/me/videos',array('flags' => array('private')));

Related

Google Drive PHP method listFiles and get return 'thumbnailLink' NULL

I'm using the PHP V2 API. I requested full access (scope: https://www.googleapis.com/auth/drive). I also tried adding all of the different scopes to no avail.
I'm fully able to retrieve all files and list them but the thumbnail link is always null. Same with 'hasThumbnail'.
I tried the API explorer on https://developers.google.com/drive/v2/reference/files/get#examples and it shows me the thumbnail links correctly.
The relevant code can be boiled down to this:
$drive = new Google_Service_Drive($this->client);;
$files = $drive->files->listFiles($parameters)->files;
This is the response from the API explorer.
The response from my code (for the same ID) is:
Found the solution. It took 5 hours to run into this such simple solution.
Not many fields show by default, you must specify which fields you want populated.
The modified basic query now is:
$this->drive->files->listFiles([
'fields' => 'nextPageToken, files(thumbnailLink, webViewLink)'
])->files;

facebook api marketing create campaign issue

I would like to create a campaign using Facebook API. I tried to run all available example without success.
First of all I created an App in order to have a APP_ID and a APP_SECRET.
I did all the procedure to add my Ad_account following the tutorial.
I downloaded all the SDK to facilitate Facebook API use like:
facebook-php-ads-sdk and run adgroup_creation.php and curl_log.php with my data, without success.
facebook-php-sdk-v4 I suppose it is less specific than the previous one.
Multi-Product Ads with the Facebook Marketing POST -> developers.facebook.com/ads/blog/post/2015/03/26/creating-multi-product-ads/
the developers reference -> developers.facebook.com/docs/reference/php/4.0.0
I used "Composer" to get all dependency.
In all this case I had problem to create a campaign using more or less this code:
$campaign = new \FacebookAds\Object\AdCampaign(null,"act_$ACCOUNT_ID");
$campaign->setData(array(
AdCampaignFields::NAME => 'My First Campaign',
AdCampaignFields::OBJECTIVE => AdObjectives::WEBSITE_CLICKS,
AdCampaignFields::STATUS => AdCampaign::STATUS_PAUSED ));
// PROBLEM is Here
$campaign->create();
Any help? How can I get a more useful error?
It's difficult to help without knowing the exact error. However, you could try this: before creating your campaign, initialize the API using:
Api::init(<your_app_id>, <your_ap_secret>, <your_token>);
(You need to load FacebookAds\Api to use this function).

how to configure the Bigcommerec api

In bigcommerce site I want functionality like anonymous users can upload image for products which he wants to purchase and add to cart.Like this (http://www.woowoonails.com/) site.
When you will open this link you will see Design Your Own Nail Wraps! container on home containing link user your own photos when you will click on this you will be on this link (http://www.woowoonails.com/designer/layout).Here you can upload your photos and click on add to bag. Same functionality I want on my site but I did not get any idea.Bigcommerce team does now allow to upload php file to their server.Then I tried to use api.
But I am not able to configure it.I have downloaded the api from (github.com/bigcommerce/bigcommerce-api-php) .But I am not getting idea how to configure it and use.
I have also download the single php file(raw.github.com/bigcommerce/bigcommerce-api-php/master/bigcommerce.php) and put it inside the Bigcommerce1 folder and then include in my file containing code:
require 'Bigcommerce1/bigcommerce.php';
BigCommerce_Api::configure(array(
'store_url' => 'siteurl',
'username' => 'admin',
'api_key' => 'df38dd10e9665a3cfa667817d78ec91ee9384bc3'
));
But nothing work.Can you give me some light about how can I achieve the functionality to upload photos and also about api configuration.
Thanks
You want to use the FTP not the BigCommerce API to capture the image... BigCommerce does support file uploading, but from what I have read it is an afterthought and is not configurable via the API. It is easier therefore to have an iframe for file upload, capturing the file contents and uploading it to the bigC (s)FTP server for storage...
This means you could post a file to any other site (so hosted externally) upload it to the FTP under some unique id, and when the order was submitted re-join the two.
Also to connect to the BigCommerce API, it is best to write or use a wrapper function library around BigCommerce
so for example we made the library object-based due to errors and undesirable functionality in the PHP version of the API, and a difference in coding styles, so we just use the following to get all orders 'Awaiting Fulfillment' and work from there...
$bcAPI = new bigcommerceAPI();
$orders = $bcAPI->getOrders();
$orders = array_filter($orders,function($data){ if($data->status == 'Awaiting Fulfillment'){ return true; } return false; });

Displaying a list of videos from a channel - Vimeo Advanced API

I need a way to display videos from a specific channel on a page using PHP.
I have authenticated my app and I can use some methods using the advanced API. I am using the official vimeo PHP library to connect.
Below is what I am trying to do and when I dump the array I do not get anything. I can get info back from using get videos from the entire account method.
require_once('/url/vimeo/vimeo.php');
$vimeo = new phpVimeo('number', 'number');
$vimeo->setToken('number','numbers');
$videos = $vimeo->call('vimeo.channels.getVideos', array('ACCOUNT' => 'NAME'));
If I put the channel name where ACCOUNT is I will get an invalid signature error.
Is it worth using something like simple HTML parser for PHP and doing it that or worth sticking with the advanced API?
I would highly advise using the advanced api. If you parse the html, it will break any time vimeo changes their channel pages. Additionally, channels have more than one layout
eg: vimeohq and nicetype
The second parameter of the "call" function should be any querystring parameters the api method requires.
In the case of "vimeo.channels.getVideos" you can provide
channel_id
user_id
page
per_page
summary_response
full_response.
To experiment with the getVideos method, you can use the playground.
So in the end, I believe you want the function to look like this..
$videos = $vimeo->call('vimeo.channels.getVideos', array('channel_id' => 'NAME'));
where NAME is either the channel id, or the channel name (the channel name matches the url slug, so for example "nicetype" not "nice type"

phpFlickr API photos_getRecent extras/owner_name isn't doing anything

I'm trying to use the photos_getRecent function which, in the source file, is described as:
function photos_getRecent ($jump_to = NULL, $extras = NULL, $per_page = NULL, $page = NULL)
I'm trying to filter the results based on the owner, which (according to the documentation http://www.flickr.com/services/api/flickr.photos.getRecent.htm) is stored in the extras variable:
"A comma-delimited list of extra information to fetch for each returned record. Currently supported fields are: description, license, date_upload, date_taken, owner_name, icon_server, original_format, last_update, geo, tags, machine_tags, o_dims, views, media, path_alias, url_sq, url_t, url_s, url_q, url_m, url_n, url_z, url_c, url_l, url_o"
So I've tried setting the extras variable to a whole lot of stuff:
photos_getRecent(NULL,"owner_name=john citizen",20,NULL);
photos_getRecent(NULL,"owner_name=john_citizen",20,NULL);
photos_getRecent(NULL,"owner_name:john citizen",20,NULL);
photos_getRecent(NULL,"owner_name:john_citizen",20,NULL);
photos_getRecent(NULL,"owner_name,john citizen",20,NULL);
photos_getRecent(NULL,"owner_name,john_citizen",20,NULL);
photos_getRecent(NULL,"owner_name=10000000#N00",20,NULL);
photos_getRecent(NULL,"owner_name:10000000#N00",20,NULL);
photos_getRecent(NULL,"owner_name,10000000#N00",20,NULL);
but none of them seem to do the trick. Every time it just gets a bunch of random photos with random owners.
Unfortunately the documentation isn't specific at all, and I can't find any examples online using this stuff.
How can I properly format the variable $extras to have it get me the photos only for that owner?
The extras parameter is used in the Flickr search to denote extra fields that you want returned by the API, not fields to search by.
To get photos by a specific owner, you'll want to use photos_search function in the phpFlickr library and pass the argument user_id for your photo owner. The default sort order is date-posted-desc which should get what you are after. For example:
photos_search (array('user_id' => '10000000#N00'));
Check out Flickr's API doco for the search function for more details.

Categories