Get list of related tracks HTTP API SoundCloud - soundcloud

I wasn't able to find anything fitting in HTTP API documentation.
As I know, there's some tracks popping out in SC widget after current track is finished, therefore there is some related tracks functionality in SC itself, yet can we access it via API?
I.e get a list of tracks, related to given track's id.

Disclaimer: This is an undocumented endpoint and is subject to change at anytime by SoundCloud.
There is an undocumented endpoint that allows you to access a track's related sounds:
HTTP GET: https://api.soundcloud.com/tracks/[TRACK_ID]/related?client_id=[YOUR_CLIENT_ID]
You didn't specify a language, so i'm just going to give a high-level overview on how to use the endpoint.
First, get your track URL. I'll use this one as an example: https://soundcloud.com/msmrsounds/ms-mr-hurricane-chvrches-remix
Then hit the resolve endpoint to get the track_id.
HTTP GET: https://api.soundcloud.com/resolve.json?url=https%3A%2F%2Fsoundcloud.com%2Fmsmrsounds%2Fms-mr-hurricane-chvrches-remix&client_id=[YOUR_CLIENT_ID]
Response:
{
"status": "302 - Found",
"location": "https://api.soundcloud.com/tracks/90787841.json?client_id=[YOUR_CLIENT_ID]"
}
Next, hit the related endpoint with your track_id.
HTTP GET: https://api.soundcloud.com/tracks/90787841/related?client_id=[YOUR_ClIENT_ID]
The full response will give you up to 50 related tracks. The response is too large to post, but it's just an array of tracks.
[
{
"kind": "track",
"id": 112741336,
"created_at": "2013/09/27 09:40:29 +0000",
"user_id": 59817646,
"duration": 215896,
"commentable": true,
"state": "finished",
"original_content_size": 38068298,
"last_modified": "2015/04/04 20:17:24 +0000",
"sharing": "public",
"tag_list": "CHVRCHES Whitney Houston Zane Lowe",
"permalink": "chvrches-its-not-right-but-its",
"streamable": true,
"embeddable_by": "all",
"downloadable": false,
"purchase_url": null,
"label_id": null,
"purchase_title": null,
"genre": "Electronic",
"title": "CHVRCHES - It's Not Right But It's Okay (Whitney Houston Cover)",
"description": "CHVRCHES - It's Not Right But It's OK (Whitney Houston Cover) from Zane's Live Sessions",
"label_name": "",
"release": "",
"track_type": "recording",
"key_signature": "",
"isrc": "",
"video_url": null,
"bpm": null,
"release_year": null,
"release_month": null,
"release_day": null,
"original_format": "wav",
"license": "all-rights-reserved",
"uri": "https://api.soundcloud.com/tracks/112741336",
"user": {
"id": 59817646,
"kind": "user",
"permalink": "uknewmusic",
"username": "UKNewMusic",
"last_modified": "2013/09/27 09:38:04 +0000",
"uri": "https://api.soundcloud.com/users/59817646",
"permalink_url": "http://soundcloud.com/uknewmusic",
"avatar_url": "https://a1.sndcdn.com/images/default_avatar_large.png"
},
"permalink_url": "http://soundcloud.com/uknewmusic/chvrches-its-not-right-but-its",
"artwork_url": "https://i1.sndcdn.com/artworks-000058757165-6tnuep-large.jpg",
"waveform_url": "https://w1.sndcdn.com/XkEffI5hwjZ7_m.png",
"stream_url": "https://api.soundcloud.com/tracks/112741336/stream",
"playback_count": 680326,
"download_count": 0,
"favoritings_count": 9241,
"comment_count": 199,
"attachments_uri": "https://api.soundcloud.com/tracks/112741336/attachments",
"policy": "ALLOW"
},
{ ...
}
]

Related

Strapi post request with relation

I'm trying to do a POST to the Strapi API and can't seem to figure out how to attach a 'has and belongs to one' (one to one) relationship from the profile to the user.
I know the relationship works well because in the admin panel I can create the relationship without any problem
I've already tried the following body's:
{
"fullName":"Test Name",
"country": "Nigeria",
"phone": "09070933598",
"verified": true,
"users_permissions_user": {
"id": 22
}
}
I got this response
{
"id": 3,
"users_permissions_user": {},
"fullName": "Test Name",
"country": "Nigeria",
"verified": true,
"plan": null,
"earnings": 0,
"availableBalance": 0,
"planRegDate": null,
"planActive": false,
"planPaymentVerified": false,
"phone": "09070933598",
"published_at": "2021-10-19T08:43:04.412Z",
"created_at": "2021-10-19T08:43:04.428Z",
"updated_at": "2021-10-19T08:43:04.470Z",
"identification": null
}
I expect to at least have some info about the user with the id passed in the body. It isn't just linking them
You need to pass the id of one of the users already in your strapi database to "users_permissions_users".
You can get this from the user object.
{
"fullName":"Test Name",
"country": "Nigeria",
"phone": "09070933598",
"verified": true,
"users_permissions_user": user.id
}

facebook graph api doesn't return the statuses i shared

I'm trying to fetch all my facebook timeline posts throw the facebook Graph API.
I'm playing with the Graph Explorer and have an access token with this permissions: (user_posts, read_stream) but when i call the endpoint "/posts" or "/feed" in the graph-api, the statues i shared (not i created) on my timeline (friends public status that i shared) didn't return.
this is a screenshot from my timeline
any idea?
If you share another POST - status then I dont think there is a way that will show up in your feed. It will show up under the user's feed who originally shared it, under posts and sharedposts
But if you share a link then it will show up under your feed as shared_story
Example from my feed
{
"data": [
{
"id": "XXXXXXXX",
"from": {
"id": "XXXXXXXX",
"name": "XXXXXXXX"
},
"story": "Vrashabh Irde shared a link.",
"story_tags": {
"0": [
{
"id": "XXXXXXXX",
"name": "XXXXXXXX",
"type": "user",
"offset": 0,
"length": 13
}
]
},
"picture": "https://fbexternal-a.akamaihd.net/safe_image.php?d=AQAvV7MyLsxFjRDc&w=130&h=130&url=https%3A%2F%2Ftctechcrunch2011.files.wordpress.com%2F2015%2F05%2Fdave-goldberg.jpg%3Fw%3D560%26h%3D292%26crop%3D1&cfs=1&sx=1&sy=0&sw=292&sh=292",
"link": "http://tcrn.ch/1GR0HU3",
"name": "Dave Goldberg, SurveyMonkey CEO, Dies Unexpectedly",
"caption": "tcrn.ch",
"description": "Silicon Valley and the wider world of technology are mourning the very sudden death of Dave Goldberg, a long time entrepreneur and investor, CEO of..",
"icon": "https://www.facebook.com/images/icons/post.gif",
"actions": [
{
"name": "Comment",
"link": "https://www.facebook.com/XXXXXXXX/posts/XXXXXXXX"
},
{
"name": "Like",
"link": "https://www.facebook.com/XXXXXXXX/posts/XXXXXXXX"
}
],
"privacy": {
"value": "ALL_FRIENDS",
"description": "Your friends",
"friends": "",
"allow": "",
"deny": ""
},
"type": "link",
"status_type": "shared_story",
"created_time": "2015-05-03T14:45:09+0000",
"updated_time": "2015-05-03T14:45:09+0000",
"is_hidden": false,
"subscribed": true
}
This is from what I know, I dont see any documentation that says otherwise, good to have someone from Facebook comment here or you should probably raise a bug if this is not intended.

How to get purchase_url from API

I added a buy link to one of my tracks and then tried to access it via API (Ruby wrapper). It displays always empty field.
Updating purchase_url is also not working, while other fields get updated.
Is this a bug or something wrong done on my side?
Can you post your URL? I'm able to retrieve this info fine from a REST console with a standard GET request.
Using this URL as an example:
https://soundcloud.com/maddecent/grandtheft-mobbin-feat
HTTP GET: https://api.soundcloud.com/resolve.json?url=https://soundcloud.com/maddecent/grandtheft-mobbin-feat&client_id=[client_id]
Returns:
{
"status": "302 - Found",
"location": "https://api.soundcloud.com/tracks/107686148.json?client_id=[client_id]"
}
Hitting the track endpoint:
HTTP GET: https://api.soundcloud.com/tracks/107686148.json?client_id=[client_id]
Returns:
{
"kind": "track",
"id": 107686148,
"created_at": "2013/08/28 17:24:39 +0000",
"user_id": 14730,
"duration": 186766,
"commentable": true,
"state": "finished",
"original_content_size": 9678964,
"last_modified": "2014/12/30 20:37:07 +0000",
"sharing": "public",
"tag_list": "Hedspin \"Mad Decent\" Jeffree's Dance Electronic Club Mobbin",
"permalink": "grandtheft-mobbin-feat",
"streamable": true,
"embeddable_by": "all",
"downloadable": false,
"purchase_url": "http://smarturl.it/GrandtheftMOB",
"label_id": null,
"purchase_title": "Buy on iTunes",
"genre": "",
"title": "Grandtheft - Mobbin feat. Hedspin",
"description": "Buy on iTunes: http://smarturl.it/GrandtheftMOB\r\nBuy on Beatport: http://bit.ly/GrandtheftBP\r\nBuy on Amazon: http://amzn.com/B00F4IFFQM\r\n\r\nRespected as one of the best live Canadian DJs in the game, Grandtheft has taken a break from globetrotting to pack in a HUGE release for Jeffree’s. Along with World Red Bull Thre3style champ and close pal Hedspin, they have made something minimal but fierce with their track “Mobbin.” The build channels the darkness of No Limit Records at its prime while the drop carries the bounce of a screwed and chopped new jack swing track. That, combined with the most menacing synth stab we’ve heard in a while, makes this tune unstoppable.\r\n\r\nWith “Give Me More,” Grandtheft lends us a soulful track that marries a delicious combination trap and dub in the same vein as his popular remix of Keys N Krates’ song “Treat Me Right” released off of Dim Mak. The juxtaposition of the drop is a total WTF moment for any club-goer and we mean that in the best way possible. Grandtheft’s momentum continues to pick up incredible speed with each release, and we don’t see his rise mellowing out anytime soon.\r\n\r\nGrandtheft\r\nSoundcloud: http://www.soundcloud.com/grandtheft\r\nFacebook: http://facebook.com/grandtheftmusic\r\nTwitter: https://twitter.com/grandtheft\r\nInstagram: http://instagram.com/itsgrandtheft\r\nYoutube: http://youtube.com/grandtheftofficial\r\n\r\nHedspin\r\nSoundcloud: https://soundcloud.com/hedspin\r\nFacebook: https://www.facebook.com/djhedspin\r\nTwitter: https://twitter.com/HEDSPIN\r\nInstagram: http://instagram.com/djhedspin",
"label_name": "Jeffree's",
"release": "JEFF060",
"track_type": "",
"key_signature": "",
"isrc": "US-Z4V-13-00221",
"video_url": null,
"bpm": null,
"release_year": 2013,
"release_month": 9,
"release_day": 17,
"original_format": "mp3",
"license": "all-rights-reserved",
"uri": "https://api.soundcloud.com/tracks/107686148",
"user": {
"id": 14730,
"kind": "user",
"permalink": "maddecent",
"username": "Mad Decent",
"last_modified": "2014/12/18 18:12:40 +0000",
"uri": "https://api.soundcloud.com/users/14730",
"permalink_url": "http://soundcloud.com/maddecent",
"avatar_url": "https://i1.sndcdn.com/avatars-000112599114-5etg3g-large.jpg"
},
"permalink_url": "http://soundcloud.com/maddecent/grandtheft-mobbin-feat",
"artwork_url": "https://i1.sndcdn.com/artworks-000056426845-b40tmr-large.jpg",
"waveform_url": "https://w1.sndcdn.com/JL8flUq6Vn0x_m.png",
"stream_url": "https://api.soundcloud.com/tracks/107686148/stream",
"playback_count": 770622,
"download_count": 16462,
"favoritings_count": 16626,
"comment_count": 489,
"attachments_uri": "https://api.soundcloud.com/tracks/107686148/attachments",
"policy": "MONETIZE"
}
Purchase info is in the JSON response:
"purchase_url": "http://smarturl.it/GrandtheftMOB",
"purchase_title": "Buy on iTunes",

Get more detail from Facebook Notifications?

I'm writing an app that gathers info from a users Facebook notifications. Using the Graph Explorer, I request:
me/notifications?include_read=true
and this returns a bunch of data. Each item is a notification item you would see when logging into Facebook. For example (ID/names changed slightly):
{
"id": "notif_630262196_168132987",
"from": {
"name": "John Bloggs",
"id": "822724665"
},
"to": {
"name": "Dermot Bloggs",
"id": "680265196"
},
"created_time": "2013-01-23T22:58:28+0000",
"updated_time": "2013-01-23T22:58:28+0000",
"title": "John Bloggs commented on your link: \"Goodbye Great Barrier Reef. Goodbye...\"",
"link": "http://www.facebook.com/<removed>/posts/330788937030559?comment_id=1702155",
"application": {
"name": "Links",
"id": "2309869772"
},
"unread": 0,
"object": null
}
The notification is in relation to a comment, but the "title:" field gets truncated if it is too long.
Is there a clean way I can programmatically access the comment directly, so I can get all the text, even if it is a 1000 character comment?
Thanks! :-)
You should be able to get the comment by parsing the link field and querying:
/330788937030559_1702155
or
/POSTID_COMMENTID
When I tested this on my account, I am getting a comments object in the returned data, with the full text of the comments. I've got most permissions enabled in my Graph API. I suspect adding read_stream to the permissions is what will give you this data.
You can avoid parsing! I've been doing a lot of experimentation with notifications and getting what I've called the 'source' object (the source object being the Facebook Graph Object from which the notification originates). Unfortunately, I can't find any documentation on how exactly this mechanism works, but if your app has been granted a lot of permissions, the "object" field which in the JSON you posted is null will actually be populated with the 'source object'. Instead of just "object" : null it will look like this:
"object": {
"id": "587140489_588632201147717",
"from": {
"name": "Dave Rodríguez",
"id": "587140489"
},
"message": ":D ",
"picture": "https://fbcdn-vthumb-a.akamaihd.net/hvthumb-ak-prn1/632550_478955408819349_478954732152750_60483_1892_t.jpg",
"link": "https://www.facebook.com/photo.php?v=478954732152750",
"source": "http://video.ak.fbcdn.net/hvideo-ak-prn1/v/754708_478955348819355_1792301950_n.mp4?oh=c7295ccfc3773f24de931e4c29f512ce&oe=513F1728&__gda__=1363127340_9302c108824176369427a0b17491b800",
"name": "¡¡¡EL SECRETO DE LA CHANCLA!!!!",
"description": "EL SECRETO DE LAS MADRES, EL MÁS UTILIZADO EN TODAS LAS GENERACIONES, VÉALO USTED MISMO Y ((COMPARTA))!",
"properties": [
{
"name": "Length",
"text": "1:13"
}
],
"icon": "https://fbstatic-a.akamaihd.net/rsrc.php/v2/yD/r/aS8ecmYRys0.gif",
"actions": [
{
"name": "Comment",
"link": "https://www.facebook.com/587140489/posts/588632201147717"
},
{
"name": "Like",
"link": "https://www.facebook.com/587140489/posts/588632201147717"
}
],
"privacy": {
"value": ""
},
"type": "video",
"status_type": "shared_story",
"object_id": "478954732152750",
"application": {
"name": "Video",
"namespace": "video",
"id": "2392950137"
},
"created_time": "2013-03-10T20:45:20+0000",
"updated_time": "2013-03-10T20:45:20+0000",
"likes": {
"data": [
{
"name": "Adrian Guerra Cuenta Verificada",
"id": "674364748"
}
],
"count": 1
},
"comments": {
"count": 0
}
}
I hope somebody more knowledgeable than me can tell us exactly what permissions we need to see this field populated. I'd figure it out myself but there are so many permissions that brute-forcing the SUM(nCk(77,k),k,1,77)=151115727451828646838271 possible combinations of permissions would take a very long time.

Does github api provide a way to get user's URL?

For example, for user:django, the url I want to retrieve thru github-api is not
https://github.com/django
but
http://www.djangoproject.com/
as shown below in the red ellipse:
The user search api does not return this url in the response.
The Data that returns from the service would be as follows:
https://api.github.com/users/django
{
"public_gists": 0,
"type": "Organization",
"followers": 240,
"login": "django",
"created_at": "2008-10-06T19:43:18Z",
"html_url": "https://github.com/django",
"avatar_url": "https://secure.gravatar.com/avatar/fd542381031aa84dca86628ece84fc07?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-org-420.png",
"company": null,
"email": null,
"blog": "http://www.djangoproject.com/",
"following": 0,
"name": "Django",
"location": "Internet",
"url": "https://api.github.com/orgs/django",
"id": 27804,
"public_repos": 49
}
As you can see, that URL is in the blog field.