{"activeVersionTag":"latest","latestAvailableVersionTag":"latest","collection":{"info":{"_postman_id":"c2a8aad6-e70c-c64c-6bff-11a4c254c30d","name":"Spotify Playlist Generator","description":"<a href=\"https://docs.google.com/drawings/d/11GIo2IAQmictmFJuxIJ3sj1zi_nFSDlm_uJMLa9I3WE/pub?w=1410&amp;h=772\" target=\"_blank\"><img src=\"https://docs.google.com/drawings/d/11GIo2IAQmictmFJuxIJ3sj1zi_nFSDlm_uJMLa9I3WE/pub?w=1410&amp;h=772\"></a>\n\nThe Spotify playlist generator collection lets you get your daily/weekly dose of fresh music. Modeled on the AMAZING [Spotify Discover Weekly](https://www.spotify.com/discoverweekly/), within 5 minutes you'll be able to set this up, and even tweak it to your heart's content!\n\n### Workflow\n\n<a href=\"https://docs.google.com/drawings/d/1p7imXUIWIC9t5vX4B5jD2XuY6MoYOYcT9I9gJVi87ic/pub?w=1532&amp;h=241\" target=\"_blank\">\n<img src=\"https://docs.google.com/drawings/d/1p7imXUIWIC9t5vX4B5jD2XuY6MoYOYcT9I9gJVi87ic/pub?w=1532&amp;h=241\"></a>\n\n1. Take a list of artists as input\n2. Randomly select an artist from this list and usse Spotify's fantastic [Get Related Artists](https://developer.spotify.com/web-api/console/get-artist-related-artists/) and [Get an Artist's top tracks](https://developer.spotify.com/web-api/console/get-artist-top-tracks/) APIs to mashup a playlist\n3. Add these related artists back to the original list and persist back to the environment\n\n### Setup the Environment\n\nClick on the Run in Postman button above to import the collection and environment template within your app.\n\n1. ##### Spotify\n    * Head to [Spotify Developer](https://developer.spotify.com) and register, then create a new app in the My Applications section. Add the `client_id` and `client_secret` to your environment.\n    * Under the newly created app config, add the following Redirect URI - `https://www.getpostman.com/oauth2/callback`\n    * We'll use the [Authorization Code Flow](https://developer.spotify.com/web-api/authorization-guide/#authorization-code-flow) to obtain the Refresh Token.\n    * Open Postman, under a new request, click on the Authorization tab, select OAuth 2.0 and fill in these values:\n\t\t- Token Name: can be anything\n    \t- Auth URL: https://accounts.spotify.com/authorize\n    \t- Access Token URL: https://accounts.spotify.com/api/token\n    \t- Client ID: {{client_id}}\n    \t- Client Secret: {{client_secret}}\n    \t- [Scope](https://developer.spotify.com/web-api/authorization-guide/#scopes): `playlist-read-private playlist-modify-private`\n    \t- Grant Type: Authorization Code\n    \t- Request access token locally: Checked\n\t* Click on Request Token, go through the OAuth flow, and add the `refresh_token` to your environment\n\n2. ##### Collection Config\n\tSet the following variables in your environment\n\t* `user_id`: your spotify username\n\t* `country_code`:  in [ISO 3166-1](http://en.wikipedia.org/wiki/ISO3166-1alpha-2) format\n\t* `N`: defaults to 5. Refer to the algorithm section for more details\n\t* `artists`: List of seed artists for the collection. You can find them as part of the Spotify artist link (Available in the app): e.g. for Oasis, the link looks something like https://open.spotify.com/artist/2DaxqgrOhkeH0fpeiQq2f4, choose the last section. The artists variable is an array of strings, so it'll look something like: [\"2DaxqgrOhkeH0fpeiQq2f4\", \"2ooIqOf4X2uz4mMptXCtie\"]\n\n### Run the Collection\n\n1. To verify that everything works as expected, run the collection in the Postman app using the [Collection Runner](https://www.getpostman.com/docs/running_collections)\n2. The same collection executes in [Newman](https://github.com/postmanlabs/newman) as well. Just export the Collection and Environment files and execute the following command\n\n```\nnewman -c SpotifyPLGen.json.postman_collection -e SpotifyPlGen.json.postman_environment\n```\n","schema":"https://schema.getpostman.com/json/collection/v2.0.0/collection.json","isPublicCollection":false,"owner":"583","team":6029,"collectionId":"c2a8aad6-e70c-c64c-6bff-11a4c254c30d","publishedId":"2MtDWP","public":true,"publicUrl":"https://documenter-api.postman.tech/view/583/2MtDWP","privateUrl":"https://go.postman.co/documentation/583-c2a8aad6-e70c-c64c-6bff-11a4c254c30d","customColor":null,"documentationLayout":"classic-double-column","version":"8.10.1","publishDate":"2016-10-26T01:50:12.000Z","activeVersionTag":"latest","documentationTheme":"light","metaTags":{},"logos":{}},"statusCode":200},"environments":[{"name":"SpotifyGenV1.template","id":"54f12b1a-44b6-8bf7-5969-a45bfe4e2bf7","owner":"583","values":[{"type":"text","enabled":true,"key":"artists","value":""},{"type":"text","enabled":true,"key":"N","value":"5"},{"type":"text","enabled":true,"key":"user_id","value":""},{"type":"text","enabled":true,"key":"country_code","value":"US"},{"type":"text","enabled":true,"key":"client_id","value":""},{"type":"text","enabled":true,"key":"client_secret","value":""},{"type":"text","enabled":true,"key":"refresh_token","value":""}],"published":true}],"user":{"authenticated":false,"permissions":{"publish":false}},"run":{"button":{"js":"https://run.pstmn.io/button.js","css":"https://run.pstmn.io/button.css"}},"web":"https://www.getpostman.com/","team":{"logo":"https://res.cloudinary.com/postman/image/upload/t_team_logo_pubdoc/v1/team/2893aede23f01bfcbd2319326bc96a6ed0524eba759745ed6d73405a3a8b67a8","favicon":"https://res.cloudinary.com/postman/image/upload/v1602695501/team/xxbaetptrvdhhptsqvnh.ico"},"isEnvFetchError":false,"languages":"[{\"key\":\"csharp\",\"label\":\"C#\",\"variant\":\"HttpClient\"},{\"key\":\"csharp\",\"label\":\"C#\",\"variant\":\"RestSharp\"},{\"key\":\"curl\",\"label\":\"cURL\",\"variant\":\"cURL\"},{\"key\":\"dart\",\"label\":\"Dart\",\"variant\":\"http\"},{\"key\":\"go\",\"label\":\"Go\",\"variant\":\"Native\"},{\"key\":\"http\",\"label\":\"HTTP\",\"variant\":\"HTTP\"},{\"key\":\"java\",\"label\":\"Java\",\"variant\":\"OkHttp\"},{\"key\":\"java\",\"label\":\"Java\",\"variant\":\"Unirest\"},{\"key\":\"javascript\",\"label\":\"JavaScript\",\"variant\":\"Fetch\"},{\"key\":\"javascript\",\"label\":\"JavaScript\",\"variant\":\"jQuery\"},{\"key\":\"javascript\",\"label\":\"JavaScript\",\"variant\":\"XHR\"},{\"key\":\"c\",\"label\":\"C\",\"variant\":\"libcurl\"},{\"key\":\"nodejs\",\"label\":\"NodeJs\",\"variant\":\"Axios\"},{\"key\":\"nodejs\",\"label\":\"NodeJs\",\"variant\":\"Native\"},{\"key\":\"nodejs\",\"label\":\"NodeJs\",\"variant\":\"Request\"},{\"key\":\"nodejs\",\"label\":\"NodeJs\",\"variant\":\"Unirest\"},{\"key\":\"objective-c\",\"label\":\"Objective-C\",\"variant\":\"NSURLSession\"},{\"key\":\"ocaml\",\"label\":\"OCaml\",\"variant\":\"Cohttp\"},{\"key\":\"php\",\"label\":\"PHP\",\"variant\":\"cURL\"},{\"key\":\"php\",\"label\":\"PHP\",\"variant\":\"Guzzle\"},{\"key\":\"php\",\"label\":\"PHP\",\"variant\":\"HTTP_Request2\"},{\"key\":\"php\",\"label\":\"PHP\",\"variant\":\"pecl_http\"},{\"key\":\"powershell\",\"label\":\"PowerShell\",\"variant\":\"RestMethod\"},{\"key\":\"python\",\"label\":\"Python\",\"variant\":\"http.client\"},{\"key\":\"python\",\"label\":\"Python\",\"variant\":\"Requests\"},{\"key\":\"r\",\"label\":\"R\",\"variant\":\"httr\"},{\"key\":\"r\",\"label\":\"R\",\"variant\":\"RCurl\"},{\"key\":\"ruby\",\"label\":\"Ruby\",\"variant\":\"Net::HTTP\"},{\"key\":\"shell\",\"label\":\"Shell\",\"variant\":\"Httpie\"},{\"key\":\"shell\",\"label\":\"Shell\",\"variant\":\"wget\"},{\"key\":\"swift\",\"label\":\"Swift\",\"variant\":\"URLSession\"}]","languageSettings":[{"key":"csharp","label":"C#","variant":"HttpClient"},{"key":"csharp","label":"C#","variant":"RestSharp"},{"key":"curl","label":"cURL","variant":"cURL"},{"key":"dart","label":"Dart","variant":"http"},{"key":"go","label":"Go","variant":"Native"},{"key":"http","label":"HTTP","variant":"HTTP"},{"key":"java","label":"Java","variant":"OkHttp"},{"key":"java","label":"Java","variant":"Unirest"},{"key":"javascript","label":"JavaScript","variant":"Fetch"},{"key":"javascript","label":"JavaScript","variant":"jQuery"},{"key":"javascript","label":"JavaScript","variant":"XHR"},{"key":"c","label":"C","variant":"libcurl"},{"key":"nodejs","label":"NodeJs","variant":"Axios"},{"key":"nodejs","label":"NodeJs","variant":"Native"},{"key":"nodejs","label":"NodeJs","variant":"Request"},{"key":"nodejs","label":"NodeJs","variant":"Unirest"},{"key":"objective-c","label":"Objective-C","variant":"NSURLSession"},{"key":"ocaml","label":"OCaml","variant":"Cohttp"},{"key":"php","label":"PHP","variant":"cURL"},{"key":"php","label":"PHP","variant":"Guzzle"},{"key":"php","label":"PHP","variant":"HTTP_Request2"},{"key":"php","label":"PHP","variant":"pecl_http"},{"key":"powershell","label":"PowerShell","variant":"RestMethod"},{"key":"python","label":"Python","variant":"http.client"},{"key":"python","label":"Python","variant":"Requests"},{"key":"r","label":"R","variant":"httr"},{"key":"r","label":"R","variant":"RCurl"},{"key":"ruby","label":"Ruby","variant":"Net::HTTP"},{"key":"shell","label":"Shell","variant":"Httpie"},{"key":"shell","label":"Shell","variant":"wget"},{"key":"swift","label":"Swift","variant":"URLSession"}],"languageOptions":[{"label":"C# - HttpClient","value":"csharp - HttpClient - C#"},{"label":"C# - RestSharp","value":"csharp - RestSharp - C#"},{"label":"cURL - cURL","value":"curl - cURL - cURL"},{"label":"Dart - http","value":"dart - http - Dart"},{"label":"Go - Native","value":"go - Native - Go"},{"label":"HTTP - HTTP","value":"http - HTTP - HTTP"},{"label":"Java - OkHttp","value":"java - OkHttp - Java"},{"label":"Java - Unirest","value":"java - Unirest - Java"},{"label":"JavaScript - Fetch","value":"javascript - Fetch - JavaScript"},{"label":"JavaScript - jQuery","value":"javascript - jQuery - JavaScript"},{"label":"JavaScript - XHR","value":"javascript - XHR - JavaScript"},{"label":"C - libcurl","value":"c - libcurl - C"},{"label":"NodeJs - Axios","value":"nodejs - Axios - NodeJs"},{"label":"NodeJs - Native","value":"nodejs - Native - NodeJs"},{"label":"NodeJs - Request","value":"nodejs - Request - NodeJs"},{"label":"NodeJs - Unirest","value":"nodejs - Unirest - NodeJs"},{"label":"Objective-C - NSURLSession","value":"objective-c - NSURLSession - Objective-C"},{"label":"OCaml - Cohttp","value":"ocaml - Cohttp - OCaml"},{"label":"PHP - cURL","value":"php - cURL - PHP"},{"label":"PHP - Guzzle","value":"php - Guzzle - PHP"},{"label":"PHP - HTTP_Request2","value":"php - HTTP_Request2 - PHP"},{"label":"PHP - pecl_http","value":"php - pecl_http - PHP"},{"label":"PowerShell - RestMethod","value":"powershell - RestMethod - PowerShell"},{"label":"Python - http.client","value":"python - http.client - Python"},{"label":"Python - Requests","value":"python - Requests - Python"},{"label":"R - httr","value":"r - httr - R"},{"label":"R - RCurl","value":"r - RCurl - R"},{"label":"Ruby - Net::HTTP","value":"ruby - Net::HTTP - Ruby"},{"label":"Shell - Httpie","value":"shell - Httpie - Shell"},{"label":"Shell - wget","value":"shell - wget - Shell"},{"label":"Swift - URLSession","value":"swift - URLSession - Swift"}],"layoutOptions":[{"value":"classic-single-column","label":"Single Column"},{"value":"classic-double-column","label":"Double Column"}],"versionOptions":[],"environmentOptions":[{"value":"0","label":"No Environment"},{"label":"SpotifyGenV1.template","value":"583-54f12b1a-44b6-8bf7-5969-a45bfe4e2bf7"}],"canonicalUrl":"https://documenter.gw.postman.com/view/metadata/2MtDWP"}