Insert API endpoint ignores Slug header - youtube-api

The filename of the inserted video is set with the "Slug" HTTP header. This worked correctly when I last used the API back at the start of 2020. Now it doesn't seem to be working, and all my videos have empty video filenames. Has this intentionally been removed from the API? There's no mention of the change in the API release notes...

Related

Mendeley API File retrieval by id fails with response code 0

I'm experimenting with the Mendeley API to upload and retrieve documents and files and have a problem with the files/{file_id} endpoint.
I have a personal Mendeley account I'm using for testing, populated with some PDF documents.
For example, on the API documentation page if I call
GET /files
I see all the files I've added, but if I take an id value, then call
GET /files/{file_id}
using the ID, e.g.
https://api.mendeley.com:443/files/7b188de2-32a7-f067-51bd-520179e866b8
I get a strange response code of 0, response headers is {}, response body is 'no content'. This happens with all the ids from the file listing - is this a bug or am I doing something wrong?
If I alter the id string, I get a 404 Not found error, which is to be expected, so it's not an authorisation or other general issue.
It's a limitation of Swagger, the software that's used to run the API documentation web page.
That endpoint returns a redirect to an S3 download URL, to allow you to grab the file. Unfortunately Swagger doesn't handle the redirect properly, and it shows it as a response code of 0.
The endpoint is working correctly; it's just not displaying properly on the documentation page.

Using Dailymotion API to retrieve Video IDs

I am trying to make a certain request work via the Dailymotion API, for work. Our client is a Dailymotion Partner who asked us to do 2 things from our application :
Generate a XML file to MRSS-upload their videos on Dailymotion (but we do not do the actual uploading, only the XML file creation)
Later, once they have uploaded their video, we have to get its Dailymotion ID (for logs necessities).
The thing is that this process has been developed circa 2012, and not fully tested. My job today is to make sure the process works now for good. In order to get the ID, we have been using this request:
https://api.dailymotion.com/video/PARTNER_NAME:GUID?fields=id
but I can't find any mention of "partner" and "guid" in the Dailymotion Documentation today. All I know is that we use the name of the channel as PARTNER_NAME and the guid we put in the XML file as GUID.
The thing I don't understand is that:
sometimes, the request does succeed and I get the ID,
most of the time, I get alternatively "400" and "403" errors from the API.
First, I tried to set the attribute "private" in the XML file to 'false', and it helped get the ID of some videos imported as public, but it does not do the trick for all videos.
Could someone show some light on this matter?

Get channel/playlist's last update time with YouTube API v3

I want to cache results to reduce the calls I make to the API based on whether something actually changed in the channel/playlist.
Is there a way to know when a channel or playlist was last updated using version 3 of the API?
In the previous version for example ProfileEntry had an Updated property.
The YouTube API uses etags for every resource and so you may be able to use them ... it would allow you to send the etag with your request and if nothing has changed, you get back a very quick 304 (so it may not reduce the number of calls you make, but it still reduces latency because your app won't have to wait for large payloads to be returned when your cached version is up-to-date).
https://developers.google.com/youtube/v3/getting-started#etags

Youtube API V3 and Etag

I use the youtube api v3 and i would like to understand how does the Etag. I would like to use it for what it takes to cache purpose but I do not know what to do in PHP.
Could you tell me the steps to follow once the etag recovered ? please. Thanks for help.
According to the youtube docs (https://developers.google.com/youtube/v3/getting-started#etags), an eTag is basically used to determine if a resource has changed. Use them for:
Optimization - Caching youtube resources in your app can reduce bandwidth and latency. When caching, store the eTag so that you can include it when getting a resource. If the resource has not changed, you will get a 304 response code (NOT MODIFIED), which means you can use your cached version. Otherwise, you will get the updated version of the resource.
Quota Usage - You can reduce the amount you tap into your quota by caching youtube data. The first time you get the resource, you will tap into your quota. Before displaying the resource, first check to see if your cached resource has changed, which will only cost you 1 quota unit. If the resource has not changed, youtube will return a 304 response. If it has changed, you can get the resource again, costing various quota units depending on what you are getting. For more on your quota: (https://developers.google.com/youtube/v3/getting-started#quota).
Overwrite protection - If you are overwriting a resource, including the eTag will ensure that you are not overwriting a newer version of the resource.
eTags are part of the HTTP 1.1 spec (http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.19) and are used in the headers of the request/response. Here's a good article that talks about them at a low level: http://www.ibuildings.com/blog/2013/07/etags-uninitiated
As far as using eTags in PHP, I can only suggest a couple things since I've never done it. YouTube returns eTags for feeds AND individual items within a feed, and I'm not sure how to use them for individual items within a feed. But to get the original feed itself, essentially you would use curl and add the eTag to the header of your request (PHP cURL custom headers). You might also want to check out http_cache_etag (http://www.php.net/manual/en/function.http-cache-etag.php)
I was looking for similar information, but I couldn't find a clear example on the youtube website. On the other hand, it seems facebook is using a similar approach (Etags to check whether a resource has changed) and these two links I found on facebook developers area might be of help:
https://developers.facebook.com/docs/reference/ads-api/etags-reference/ and https://developers.facebook.com/blog/post/627/
The first one explains in a simpler and more detailed way how etags are used and provide some request/response examples.
The second link provides a PHP example on how to retrieve a resource and extract the etag and use it in a subsequent request.
Of course these links contain information related to facebook website, but for the great part they can be applied to youtube as well.
I am not sure if anyone would still be interested but I have posted an answer on how to use etag in using the youtube api here. The idea works not only for the youtube api. The post is quite long but hope it can help.

Search.twitter.com Atom Feed doesn't work (?)

I'm using the Joomla 1.5 Feed module to display Tweets on my website. Now it suddenly doesn't work anymore (it was still working yesterday). Is anyone aware of any changes Twitter made in their syntax or anything? I'm using the following line to get the tweets: http://search.twitter.com/search?q=from%3AUsername
This API has now been retired:
Requests to search.twitter.com/search.* will receive HTTP 410 Gone. Use GET search/tweets instead.
note also that:
JSON is API v1.1's only output format. XML, RSS, and ATOM response formats will be retired along with API v1.

Resources