How to delete an image on Imageshack using its API - api

I'm trying to use the Imageshack api to delete an image uploaded to my account.
I have successfully managed to upload an image to it using the API.
https://www.imageshack.us/upload_api.php?url=[URL_OF_THE_IMAGE]&key=[MY_KEY]
I can delete the image uploaded by using the standard interface.
Any solution using the API?

I have managed it by doing the following:
First log in to get an auth_token:
HTTP POST
https://api.imageshack.us/v1/user/login?username=YOUR_USERNAME&password=YOUR_PASSWORD
Parse "auth_token" from the response
Then delete:
HTTP DELETE
https://api.imageshack.us/v1/images/SERVER/FILENAME?auth_token=AUTHTOKEN
In addition to AUTHTOKEN you need include SERVER and FILENAME, I store these from files.server and files.image.filename that come back in the response to the upload API call.

Jamie Clark's solution is what you need, using the proper v1 api. Your sample script is still using the posting methodology from their older API as described here. That one doesn't expose any deletion methods. What Jamie is describing is the API as it is currently, documented here. It's not clear if the API keys are the same, but I'm guessing no - my new one doesn't seem to work with this old call and the link from that google code page for requesting an API key is defunct.

Related

Twitter API V2 video url

I'm trying to fetch a tweet's video url using API V2.
Using API V1.1 I can use
https://api.twitter.com/1.1/statuses/show.json?id=<ID>&include_entities=true
and get the direct mp4 urls in the response at
extended_entities.media[0].video_info.variants
But using API V2 I can't seem to find any ways to get those, I was only able to get the video thumbnail but not the actual video.
I've tried it with both the lookup and the recent search endpoints but couldn't find a way to do that.
In lookup docs twitter says:
This endpoint was recently graduated from Twitter Developer Labs, and is the replacement of v1.1 statuses/show, v1.1 statuses/lookup, and Labs Tweet lookup. If you are currently using any of these endpoints, you can use our migration materials to start working with this new endpoint.
but that doesn't seem to be the case, is that feature not included ? Also if there is any other way to be able to embed a twitter video in a web page (without the tweet text) that'd be helpful.
The videos are not currently available in the Twitter API v2 at this time. This is a known request.
For those who still looking for an answer, you can do it on the V2 by adding the following parameters :
expansions=attachments.media_keys
media.fields=variants
Your final link should give https://api.twitter.com/2/users/{{uid}}/tweets?expansions=attachments.media_keys&media.fields=variants
Source : https://developer.twitter.com/en/docs/twitter-api/data-dictionary/object-model/media
Progress on twitter-api-v2 media handling, Maybe this will allow the video URLs too in the response.
https://twittercommunity.com/t/v1-1-media-endpoints-available-for-essential-access-in-the-twitter-api-v2/171664

Vimeo Upload API

I'm trying to upload videos to my Vimeo account via their API using the TUS approach.
I've managed to get the first step working fine, using POST https://api.vimeo.com/me/videos to create the video placeholder in Vimeo, and getting a response which includes the video upload.upload_link
The second step requires the binary data of the video to be patched to the upload link returned in step one using PATCH{upload.upload_link} along with some specific headers, which is fine, but what I'm struggling to work out is where and how exactly to include the binary data, as it doesn't really say in the Vimeo API documentation.
Do I just put the binary data in the Body, on it's own? Or do I need to insert it between some code in the body? Or do I set a parameter and add it as a key value, and if so what is the key?
Also, I'm assuming it should be a binary string and not base64, is that correct?
Any help or guidance on this would be much appreciated.
You put the binary data directly in the request body. Vimeo API uploading uses the tus upload protocol. There is more information about the PATCH request at https://tus.io/protocols/resumable-upload.html#patch

OneDrive API: creating and receiving item (embedded) links

1) How do I create an embedded link via the OneDrive API (https://api.onedrive.com/)? I know that it is possible to create a view or edit link via the following POST call via:
POST https://api.onedrive.com/v1.0/drive/items/{item-id}/action.createLink
Body: { "type": "view|edit" }
But requesting 'embed' isn't possible, although the documentation shows that it is one of the valid types. I know that it is possible via the Live SDK:
https://apis.live.net/v5.0/{file-ID}/embed?access_token=ACCESS_TOKEN
But how do I do this for the OneDrive API?
2) Is it possible to receive the already existing links via the OneDrive API in another way than via creating a new one via {file-ID}/action.createLink call? For example by expanding the metadata?
https://api.onedrive.com/v1.0/drive/items/{item-id}?expand=***links/permissions***
I found that the same question was asked on the Github OneDrive forum. You see their answers below:
Currently the OneDrive API only supports view and read links. You can vote to include embed support via their User Voice page.
In the future, you'll be able to enumerate existing links on an item (at least those links created by your app) to discover existing URLs without the need to call createLink. There is not yet a timeframe for when we'll roll that out, but it should be soon.

How do I upload a photo / image to LinkedIn via API?

LinkedIn has a /share API endpoint which accepts a link and a message. The link is afterwards expanded to an OpenGraph card and that gives you a way to stick an image preview in there, but it seems there's no other way to upload an image/picture to LinkedIn feed like you can do in the web app itself.
Is there a way, private API, undocumented endpoint or some other way to do that?
Creating a rich media share is done in two steps. First, the media is uploaded to LinkedIn's media platform. Then, a personal or organization share referencing that media is created.
This URL might be help you.
https://developer.linkedin.com/docs/guide/v2/shares/rich-media-shares#upload
No. You need to give us the URL and we'll scrape it (or pull it from our cache).

Soundcloud explore section

I am exploring soundcloud's API, and I have seen that thought through the web you can access explore sections, I haven't found any docs that help you to do so through the API.
Anyone has tried this before?
soundcloud explore section uses new API calls that are still not documented. same with stream.
but you can check under the hood (in chrome developer tools -> network tab) to find new api calls.
for example, main explore section points to https://api.soundcloud.com/explore/sounds/category?limit=10&offset=0&linked_partitioning=1
and rock section points to
https://api.soundcloud.com/explore/sounds/category/rock?limit=10&offset=0&linked_partitioning=1
p.s. don't forget to include your client id in the calls
The API has been updated. You can use following URL to access the explore section (based on #cucko's reply):
https://api-v2.soundcloud.com/explore/categories?limit=10&offset=0&linked_partitioning=1
With client id in the call:
https://api-v2.soundcloud.com/explore/categories?limit=10&offset=0&linked_partitioning=1&client_id=YOUR_CLIENT_ID
The API has been updated.You can use following URL
https://api-v2.soundcloud.com/charts?kind=top&genre=soundcloud%3Agenres%3Aall-music&limit=20&offset=0&linked_partitioning=1&client_id=YOUR_CLIENT_ID