Why lastfm api returns the wrong image? - api

When I get track.search or user.getLovedTracks response, they have an image, but if I saw on any of the provided links then there will be a white image with a star, although if I go to my loved tracks page in lastfm the images will be correct.
For the example.
At lastfm:
https://i.stack.imgur.com/OKc5e.png
link to image: https://lastfm.freetls.fastly.net/i/u/64s/9c7a96efcdfa4e03cc8e1b65daac5281.jpg
At my service:
https://i.stack.imgur.com/dpIhj.png
link to image in request response: https://lastfm.freetls.fastly.net/i/u/64s/2a96cbd8b46e442fc41c2b86b821562f.png
The api returns a whole array of links to images, but they are all incorrect
https://i.stack.imgur.com/Uiwrl.png
If you send a request with the track.getInfo method will response like:
{
"track": {
"name": "Без ключа",
"url": "https://www.last.fm/music/Pharaoh/_/%D0%91%D0%B5%D0%B7+%D0%BA%D0%BB%D1%8E%D1%87%D0%B0",
"duration": "159000",
"streamable": {
"#text": "0",
"fulltrack": "0"
},
"listeners": "10491",
"playcount": "78974",
"artist": {
"name": "Pharaoh",
"mbid": "a6ed750a-7293-4e08-ba03-832373eb136b",
"url": "https://www.last.fm/music/Pharaoh"
},
"album": {
"artist": "Pharaoh",
"title": "Правило",
"url": "https://www.last.fm/music/Pharaoh/%D0%9F%D1%80%D0%B0%D0%B2%D0%B8%D0%BB%D0%BE",
"image": [{
"#text": "https://lastfm.freetls.fastly.net/i/u/34s/6e92fe0cff920f671ee5eb4e2f0f4e59.png",
"size": "small"
}, {
"#text": "https://lastfm.freetls.fastly.net/i/u/64s/6e92fe0cff920f671ee5eb4e2f0f4e59.png",
"size": "medium"
}, {
"#text": "https://lastfm.freetls.fastly.net/i/u/174s/6e92fe0cff920f671ee5eb4e2f0f4e59.png",
"size": "large"
}, {
"#text": "https://lastfm.freetls.fastly.net/i/u/300x300/6e92fe0cff920f671ee5eb4e2f0f4e59.png",
"size": "extralarge"
}]
},
"toptags": {
"tag": []
}
}
}
and the links in the album image will be correct

Related

How to create a new database on Notion API with the new "Status" property?

Notion API HTTP requests are not working when I add a new "Status" propoerty for a new database creation.
I've been trying for a while to figure out why, sending Notion a simple HTTP POST request with a "Status" breaks it.
If I just replace "Status" with a simple "Select" it works fine...
This is the code that I tried on my latest attempt:
{
"is_inline": true,
"parent": {
"type": "page_id",
"page_id": page_id
},
"icon": {
"type": "emoji",
"emoji": "🐟"
},
"title": [
{
"type": "text",
"text": {
"content": "Catches",
"link": null
}
}
],
"properties": {
"Name": {
"title": {}
},
"Status": {
"status": {
"options": [
{
"name": "Not started",
"color": "default"
},
{
"name": "25% Complete",
"color": "blue"
},
{
"name": "50% Complete",
"color": "blue"
},
{
"name": "75% Complete",
"color": "blue"
},
{
"name": "Done",
"color": "green"
},
{
"name": "Blocked",
"color": "red"
}
]
}
}
}
}
Status ref page on Notions docs: https://developers.notion.com/reference/property-object#status-configuration

Shopware 6 API / Product Listing / How to add available color variants for each product on the response

API Request
/store-api/product-listing/{categoryId}
I want each product in the API response to have available color variants. Because I want to show color variants on the product list page. But currently this data is not provided by the shopware 6 api.
I've tried to add this data by using associations but it didnt help.
Request Body
{
"includes": {
"product": ["id", "productNumber", "cover", "options"]
},
"associations": {
"options": {
"media": []
}
}
}
The request body looks to be correct. If the product is a variant then it should have content for options.
To verify try the following request body:
{
"limit": 1,
"includes": {
"product": ["id", "productNumber", "options"],
"property_group_option": ["name", "group"],
"property_group": ["name"]
},
"associations": {
"options": {
"associations": {
"group": []
}
}
},
"filters": [
{
"type": "not",
"operator": "and",
"queries": [
{
"type": "equals",
"field": "parentId",
"value": null
}
]
}
]
}
This should yield a single variant.
Response should look similar to this:
{
"entity": "product",
"total": 1,
"aggregations": [],
"page": 1,
"limit": 1,
"elements": [
{
"productNumber": "10042.1",
"options": [
{
"name": "linen",
"group": {
"name": "textile",
"apiAlias": "property_group"
},
"apiAlias": "property_group_option"
},
{
"name": "35",
"group": {
"name": "size",
"apiAlias": "property_group"
},
"apiAlias": "property_group_option"
},
{
"name": "chartreuse",
"group": {
"name": "shirt-color",
"apiAlias": "property_group"
},
"apiAlias": "property_group_option"
}
],
"id": "0002ea44c49c41ecb91c43e7e49e422d",
"apiAlias": "product"
}
],
"states": [],
"apiAlias": "dal_entity_search_result"
}

HTTP Post with ContentURL

I a using Microsoft Bot Framework and am trying to do a HTTP Post with an image sent to the bot as an attachment. I see a ContentURL in the Attachment object but cannot figure out how to POST the image to my API with RestSharp?
Any Ideas?
There are a couple possibilities here.
First is to send an image as an attachment. Please see this documentation you JSON would look like this:
{
"type": "message",
"from": {
"id": "12345678",
"name": "sender's name"
},
"conversation": {
"id": "abcd1234",
"name": "conversation's name"
},
"recipient": {
"id": "1234abcd",
"name": "recipient's name"
},
"text": "Here's a picture of the duck I was telling you about.",
"attachments": [
{
"contentType": "image/png",
"contentUrl": "http://aka.ms/Fo983c",
"name": "duck-on-a-rock.jpg"
}
],
"replyToId": "5d5cdc723
}
the other possibility is that you could send an image in a card (which has 2 possibilities itself). For this you can see this documentation for rich cards. in this here is an example of the JSON for that
{
"type": "message",
"from": {
"id": "12345678",
"name": "sender's name"
},
"conversation": {
"id": "abcd1234",
"name": "conversation's name"
},
"recipient": {
"id": "1234abcd",
"name": "recipient's name"
},
"attachments": [
{
"contentType": "application/vnd.microsoft.card.hero",
"content": {
"title": "title goes here",
"subtitle": "subtitle goes here",
"text": "descriptive text goes here",
"images": [
{
"url": "http://aka.ms/Fo983c",
"alt": "picture of a duck",
"tap": {
"type": "playAudio",
"value": "url to an audio track of a duck call goes here"
}
}
],
"buttons": [
{
"type": "playAudio",
"title": "Duck Call",
"value": "url to an audio track of a duck call goes here"
},
{
"type": "openUrl",
"title": "Watch Video",
"image": "http://aka.ms/Fo983c",
"value": "url goes here of the duck in flight"
}
]
}
}
],
"replyToId": "5d5cdc723"
}
the second option for cards would be adaptive cards. by using the visualizer you can actually manipulate the JSON and see how it would be rendered in different channels.

geoserver upload kml no format

I'm using the API of the geoserver (link) to upload a new kml file to mu local machine using a post request to http://localhost:8080/geoserver/rest/imports with the following json
{
"import": {
"targetWorkspace": {
"workspace": {
"name": "sample"
}
},
"targetStore": {
"dataStore": {
"name": "sample"
}
},
"data": {
"type": "file",
"file": "/data/sample_dir/sample.kml"
}
}
}
I should get the data type and the state as ready on the response according to the API documentation but I'm getting a pending and no file format.
Response:
{
"import": {
"id": 23,
"href": "http://localhost:8080/geoserver/rest/imports/23",
"state": "PENDING",
"archive": false,
"targetWorkspace": {
"workspace": {
"name": "sample"
}
},
"targetStore": {
"dataStore": {
"name": "sample",
"type": "Directory of spatial files (shapefiles)"
}
},
"data": {
"type": "file",
"format": null,
"file": "sample.kml"
},
"tasks": []
}
}
Apparently the geoserver don't accept the relative path like it says on the API documentation.
If instead of:
"data": {
"type": "file",
"file": "./data/sample_dir/sample.kml"
}
I use
"data": {
"type": "file",
"file": "/var/lib/tomcat7/webapps/geoserver/data/sample_dir/sample.kml"
}
on the request it works fine.

Searching YouTube by video quality, duration, upload date and keywords?

Although I can easily do this on the YouTube.com advanced search page, I can't seem to get it to work with their API.
E.g.: From the explorer page
Does anyone know the trick to getting this to work?
You can search by video quality, duration, upload date, and keywords using the Search of the YouTube Data API v3
https://developers.google.com/youtube/v3/docs/search
you can use the following filters:
publishedAfter / datetime
publishedBefore / datetime
q / string (keywords)
videoDefinition / string (any /high /standard )
videoDuration / string (any /long /medium /short )
and also you must be careful and set the type parameter as video to specify this filters.
This is a sample call:
Request:
GET https://www.googleapis.com/youtube/v3/search?part=snippet&publishedAfter=2011-01-01T00%3A00%3A00Z&q=coke&type=video&videoDefinition=high&videoDuration=short&key={YOUR_API_KEY}
Response:
200 OK
- Show headers -
{
"kind": "youtube#searchListResponse",
"etag": "\"rFqCJSkEICLP3Hq6a4AADI7kf48/aTddnYr9r7d0D4Q5PzPGfWpsecI\"",
"pageInfo": {
"totalResults": 1000000,
"resultsPerPage": 5
},
"nextPageToken": "CAUQAA",
"items": [
{
"kind": "youtube#searchResult",
"etag": "\"rFqCJSkEICLP3Hq6a4AADI7kf48/Ej9FPd2YyubbQoYtuBZ_tT1Zjck\"",
"id": {
"kind": "youtube#video",
"videoId": "5T68TvdoSbI"
},
"snippet": {
"publishedAt": "2013-06-20T15:00:35.000Z",
"channelId": "UC1zZE_kJ8rQHgLTVfobLi_g",
"title": "Self Freezing Coca-Cola (The trick that works on any soda!)",
"description": "Take any bottle of soda, and get it to freeze on command! This \"super cool\" trick works with cans of soda as well. To date, I haven't seen any tutorials on e...",
"thumbnails": {
"default": {
"url": "https://i.ytimg.com/vi/5T68TvdoSbI/default.jpg"
},
"medium": {
"url": "https://i.ytimg.com/vi/5T68TvdoSbI/mqdefault.jpg"
},
"high": {
"url": "https://i.ytimg.com/vi/5T68TvdoSbI/hqdefault.jpg"
}
},
"channelTitle": "01032010814"
}
},
{
"kind": "youtube#searchResult",
"etag": "\"rFqCJSkEICLP3Hq6a4AADI7kf48/TAH9npB-WK5-tntpUczojivt_nk\"",
"id": {
"kind": "youtube#video",
"videoId": "FaMWxLCGY0U"
},
"snippet": {
"publishedAt": "2011-04-23T00:57:00.000Z",
"channelId": "UCIgKGGJkt1MrNmhq3vRibYA",
"title": "Gallium Induced Structural Failure of a Coke Can",
"description": "We show how a normally strong and robust coke can is turned into the equivalent of wet tissue paper with gallium. If you want some gallium yourself, you can ...",
"thumbnails": {
"default": {
"url": "https://i.ytimg.com/vi/FaMWxLCGY0U/default.jpg"
},
"medium": {
"url": "https://i.ytimg.com/vi/FaMWxLCGY0U/mqdefault.jpg"
},
"high": {
"url": "https://i.ytimg.com/vi/FaMWxLCGY0U/hqdefault.jpg"
}
},
"channelTitle": "NurdRage"
}
},
{
"kind": "youtube#searchResult",
"etag": "\"rFqCJSkEICLP3Hq6a4AADI7kf48/ZbkW-ovCwrd7bU0s44Yc6ZNF8uQ\"",
"id": {
"kind": "youtube#video",
"videoId": "KEBJmZL8G1E"
},
"snippet": {
"publishedAt": "2012-06-06T20:16:20.000Z",
"channelId": "UCosXctaTYxN4YPIvI5Fpcrw",
"title": "The Most Outrageous Way to Share a Coke",
"description": "What is the most outrageous way to share a Coke? Watch this video to see what iJustine, Josh TheComputerNerd01 and a few new friends came up with -- an ...",
"thumbnails": {
"default": {
"url": "https://i.ytimg.com/vi/KEBJmZL8G1E/default.jpg"
},
"medium": {
"url": "https://i.ytimg.com/vi/KEBJmZL8G1E/mqdefault.jpg"
},
"high": {
"url": "https://i.ytimg.com/vi/KEBJmZL8G1E/hqdefault.jpg"
}
},
"channelTitle": "cocacola"
}
},
{
"kind": "youtube#searchResult",
"etag": "\"rFqCJSkEICLP3Hq6a4AADI7kf48/I04dl1Hbm3FTzhGu8xIbRfHQ5XM\"",
"id": {
"kind": "youtube#video",
"videoId": "b6u9WJ01Oxs"
},
"snippet": {
"publishedAt": "2011-09-28T01:01:55.000Z",
"channelId": "UCUK0HBIBWgM2c4vsPhkYY4w",
"title": "EPIC Mentos and Coke - The Slow Mo Guys",
"description": "Volume UP, Watch in HD! Gav and Dan bring you the most epic mentos and coke video ever. Well, I say epic... It's more accurately the MOST OVERLY DRAMATIC men...",
"thumbnails": {
"default": {
"url": "https://i.ytimg.com/vi/b6u9WJ01Oxs/default.jpg"
},
"medium": {
"url": "https://i.ytimg.com/vi/b6u9WJ01Oxs/mqdefault.jpg"
},
"high": {
"url": "https://i.ytimg.com/vi/b6u9WJ01Oxs/hqdefault.jpg"
}
},
"channelTitle": "theslowmoguys"
}
},
{
"kind": "youtube#searchResult",
"etag": "\"rFqCJSkEICLP3Hq6a4AADI7kf48/JlSU5F38dpMSZwynbS2ztIpSNr8\"",
"id": {
"kind": "youtube#video",
"videoId": "gy5hTC1ox9A"
},
"snippet": {
"publishedAt": "2013-05-29T06:22:07.000Z",
"channelId": "UCDZESjYAwh-ws7ZSZZ8DKeg",
"title": "2 Liter Diet Coke Challenge (No Burping)",
"description": "L.A. BEAST responds to a challenge created by fellow competitive eater Matt \"The Megatoad\" Stonie, in which one must drink an entire 2 liter bottle of Diet C...",
"thumbnails": {
"default": {
"url": "https://i.ytimg.com/vi/gy5hTC1ox9A/default.jpg"
},
"medium": {
"url": "https://i.ytimg.com/vi/gy5hTC1ox9A/mqdefault.jpg"
},
"high": {
"url": "https://i.ytimg.com/vi/gy5hTC1ox9A/hqdefault.jpg"
}
},
"channelTitle": "skippy62able"
}
}
]
}