diff --git a/testing/Maloja.postman_collection.json b/testing/Maloja.postman_collection.json index 86b4126..acb570b 100644 --- a/testing/Maloja.postman_collection.json +++ b/testing/Maloja.postman_collection.json @@ -1,602 +1,809 @@ { "info": { - "_postman_id": "632b8649-8470-43d3-934d-8c89dc90464c", + "_postman_id": "71b19d5e-78a1-4a4a-98b5-12cbf2f13fe6", "name": "Maloja", "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json" }, "item": [ { - "name": "Scrobble Native", + "name": "Scrobbling", "item": [ { - "name": "Query String", - "request": { - "method": "POST", - "header": [], - "body": { - "mode": "formdata", - "formdata": [] - }, - "url": { - "raw": "{{url}}/apis/mlj_1/newscrobble?key={{api_key}}&artist={{example_artist}}&title={{example_song}}&artist={{example_artist_2}}", - "host": [ - "{{url}}" - ], - "path": [ - "apis", - "mlj_1", - "newscrobble" - ], - "query": [ - { - "key": "key", - "value": "{{api_key}}" + "name": "Scrobble Native", + "item": [ + { + "name": "Query String", + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "formdata", + "formdata": [] }, - { - "key": "artist", - "value": "{{example_artist}}" - }, - { - "key": "title", - "value": "{{example_song}}" - }, - { - "key": "artist", - "value": "{{example_artist_2}}" + "url": { + "raw": "{{url}}/apis/mlj_1/newscrobble?key={{api_key}}&artist={{data.artist1}}&title={{data.title1}}&artist={{data.artist2}}", + "host": [ + "{{url}}" + ], + "path": [ + "apis", + "mlj_1", + "newscrobble" + ], + "query": [ + { + "key": "key", + "value": "{{api_key}}" + }, + { + "key": "artist", + "value": "{{data.artist1}}" + }, + { + "key": "title", + "value": "{{data.title1}}" + }, + { + "key": "artist", + "value": "{{data.artist2}}" + } + ] } - ] - } - }, - "response": [] - }, - { - "name": "Query String Redirect", - "request": { - "method": "POST", - "header": [], - "url": { - "raw": "{{url}}/api/newscrobble?key={{api_key}}&artist={{example_artist}}&title={{example_song}}&artist={{example_artist_2}}", - "host": [ - "{{url}}" - ], - "path": [ - "api", - "newscrobble" - ], - "query": [ - { - "key": "key", - "value": "{{api_key}}" - }, - { - "key": "artist", - "value": "{{example_artist}}" - }, - { - "key": "title", - "value": "{{example_song}}" - }, - { - "key": "artist", - "value": "{{example_artist_2}}" - } - ] - } - }, - "response": [] - }, - { - "name": "Formdata", - "request": { - "method": "POST", - "header": [], - "body": { - "mode": "formdata", - "formdata": [ - { - "key": "key", - "value": "{{api_key}}", - "type": "text" - }, - { - "key": "artist", - "value": "{{example_artist}}", - "type": "text" - }, - { - "key": "title", - "value": "{{example_song}}", - "type": "text" - }, - { - "key": "artist", - "value": "{{example_artist_2}}", - "type": "text" - } - ] - }, - "url": { - "raw": "{{url}}/apis/mlj_1/newscrobble", - "host": [ - "{{url}}" - ], - "path": [ - "apis", - "mlj_1", - "newscrobble" - ] - } - }, - "response": [] - }, - { - "name": "Formdata Redirect", - "request": { - "method": "POST", - "header": [], - "body": { - "mode": "formdata", - "formdata": [ - { - "key": "key", - "value": "{{api_key}}", - "type": "text" - }, - { - "key": "artist", - "value": "{{example_artist}}", - "type": "text" - }, - { - "key": "title", - "value": "{{example_song}}", - "type": "text" - }, - { - "key": "artist", - "value": "{{example_artist_2}}", - "type": "text" - } - ] - }, - "url": { - "raw": "{{url}}/api/newscrobble", - "host": [ - "{{url}}" - ], - "path": [ - "api", - "newscrobble" - ] - } - }, - "response": [] - }, - { - "name": "JSON", - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "name": "Content-Type", - "value": "application/json", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"key\": \"{{api_key}}\",\n \"artist\": \"{{example_artist}}\",\n \"title\": \"{{example_song}}\"\n}" - }, - "url": { - "raw": "{{url}}/apis/mlj_1/newscrobble", - "host": [ - "{{url}}" - ], - "path": [ - "apis", - "mlj_1", - "newscrobble" - ] - } - }, - "response": [] - }, - { - "name": "JSON Multiartist", - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "name": "Content-Type", - "type": "text", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"key\": \"{{api_key}}\",\n \"artists\": [\"{{example_artist}}\",\"{{example_artist_2}}\"],\n \"title\": \"{{example_song}}\"\n}" - }, - "url": { - "raw": "{{url}}/apis/mlj_1/newscrobble", - "host": [ - "{{url}}" - ], - "path": [ - "apis", - "mlj_1", - "newscrobble" - ] - } - }, - "response": [] - }, - { - "name": "JSON Redirect", - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "name": "Content-Type", - "type": "text", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"key\": \"{{api_key}}\",\n \"artist\": \"{{example_artist}}\",\n \"title\": \"{{example_song}}\"\n}" - }, - "url": { - "raw": "{{url}}/api/newscrobble", - "host": [ - "{{url}}" - ], - "path": [ - "api", - "newscrobble" - ] - } - }, - "response": [] - } - ] - }, - { - "name": "Scrobble Listenbrainz", - "item": [ - { - "name": "JSON", - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "name": "Content-Type", - "value": "application/json", - "type": "text" }, - { - "key": "Authorization", - "value": "token {{api_key}}", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"listen_type\":\"single\",\n\t\"payload\":[\n\t\t{\n\t\t\t\"track_metadata\":{\n\t\t\t\t\"artist_name\":\"{{example_artist}}\",\n\t\t\t\t\"track_name\":\"{{example_song}}\"\n\t\t\t}\n\t\t}\n\t]\n}" + "response": [] }, - "url": { - "raw": "{{url}}/apis/listenbrainz/1/submit-listens", - "host": [ - "{{url}}" - ], - "path": [ - "apis", - "listenbrainz", - "1", - "submit-listens" - ] - } - }, - "response": [] - }, - { - "name": "JSON Redirect", - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "name": "Content-Type", - "type": "text", - "value": "application/json" + { + "name": "Query String Redirect", + "request": { + "method": "POST", + "header": [], + "url": { + "raw": "{{url}}/api/newscrobble?key={{api_key}}&artist={{data.artist1}}&title={{data.title1}}&artist={{data.artist2}}", + "host": [ + "{{url}}" + ], + "path": [ + "api", + "newscrobble" + ], + "query": [ + { + "key": "key", + "value": "{{api_key}}" + }, + { + "key": "artist", + "value": "{{data.artist1}}" + }, + { + "key": "title", + "value": "{{data.title1}}" + }, + { + "key": "artist", + "value": "{{data.artist2}}" + } + ] + } }, - { - "key": "Authorization", - "type": "text", - "value": "token {{api_key}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"listen_type\":\"single\",\n\t\"payload\":[\n\t\t{\n\t\t\t\"track_metadata\":{\n\t\t\t\t\"artist_name\":\"{{example_artist}}\",\n\t\t\t\t\"track_name\":\"{{example_song}}\"\n\t\t\t}\n\t\t}\n\t]\n}" + "response": [] }, - "url": { - "raw": "{{url}}/api/s/listenbrainz/1/submit-listens", - "host": [ - "{{url}}" - ], - "path": [ - "api", - "s", - "listenbrainz", - "1", - "submit-listens" - ] + { + "name": "Formdata", + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "formdata", + "formdata": [ + { + "key": "key", + "value": "{{api_key}}", + "type": "text" + }, + { + "key": "artist", + "value": "{{data.artist1}}", + "type": "text" + }, + { + "key": "title", + "value": "{{data.title1}}", + "type": "text" + }, + { + "key": "artist", + "value": "{{data.artist2}}", + "type": "text" + } + ] + }, + "url": { + "raw": "{{url}}/apis/mlj_1/newscrobble", + "host": [ + "{{url}}" + ], + "path": [ + "apis", + "mlj_1", + "newscrobble" + ] + } + }, + "response": [] + }, + { + "name": "Formdata Redirect", + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "formdata", + "formdata": [ + { + "key": "key", + "value": "{{api_key}}", + "type": "text" + }, + { + "key": "artist", + "value": "{{data.artist1}}", + "type": "text" + }, + { + "key": "title", + "value": "{{data.title1}}", + "type": "text" + }, + { + "key": "artist", + "value": "{{data.artist2}}", + "type": "text" + } + ] + }, + "url": { + "raw": "{{url}}/api/newscrobble", + "host": [ + "{{url}}" + ], + "path": [ + "api", + "newscrobble" + ] + } + }, + "response": [] + }, + { + "name": "JSON", + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "name": "Content-Type", + "value": "application/json", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"key\": \"{{api_key}}\",\n \"artist\": \"{{data.artist1}}\",\n \"title\": \"{{data.title1}}\"\n}" + }, + "url": { + "raw": "{{url}}/apis/mlj_1/newscrobble", + "host": [ + "{{url}}" + ], + "path": [ + "apis", + "mlj_1", + "newscrobble" + ] + } + }, + "response": [] + }, + { + "name": "JSON Multiartist", + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "name": "Content-Type", + "type": "text", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"key\": \"{{api_key}}\",\n \"artists\": [\"{{data.artist1}}\",\"{{data.artist2}}\"],\n \"title\": \"{{data.title1}}\"\n}" + }, + "url": { + "raw": "{{url}}/apis/mlj_1/newscrobble", + "host": [ + "{{url}}" + ], + "path": [ + "apis", + "mlj_1", + "newscrobble" + ] + } + }, + "response": [] + }, + { + "name": "JSON Redirect", + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "name": "Content-Type", + "type": "text", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"key\": \"{{api_key}}\",\n \"artist\": \"{{data.artist1}}\",\n \"title\": \"{{data.artist2}}\"\n}" + }, + "url": { + "raw": "{{url}}/api/newscrobble", + "host": [ + "{{url}}" + ], + "path": [ + "api", + "newscrobble" + ] + } + }, + "response": [] } - }, - "response": [] + ] + }, + { + "name": "Scrobble Listenbrainz", + "item": [ + { + "name": "JSON", + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "name": "Content-Type", + "value": "application/json", + "type": "text" + }, + { + "key": "Authorization", + "value": "token {{api_key}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"listen_type\":\"single\",\n\t\"payload\":[\n\t\t{\n\t\t\t\"track_metadata\":{\n\t\t\t\t\"artist_name\":\"{{data.artist1}}\",\n\t\t\t\t\"track_name\":\"{{data.title1}}\"\n\t\t\t}\n\t\t}\n\t]\n}" + }, + "url": { + "raw": "{{url}}/apis/listenbrainz/1/submit-listens", + "host": [ + "{{url}}" + ], + "path": [ + "apis", + "listenbrainz", + "1", + "submit-listens" + ] + } + }, + "response": [] + }, + { + "name": "JSON Redirect", + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "name": "Content-Type", + "type": "text", + "value": "application/json" + }, + { + "key": "Authorization", + "type": "text", + "value": "token {{api_key}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"listen_type\":\"single\",\n\t\"payload\":[\n\t\t{\n\t\t\t\"track_metadata\":{\n\t\t\t\t\"artist_name\":\"{{data.artist1}}\",\n\t\t\t\t\"track_name\":\"{{data.title1}}\"\n\t\t\t}\n\t\t}\n\t]\n}" + }, + "url": { + "raw": "{{url}}/api/s/listenbrainz/1/submit-listens", + "host": [ + "{{url}}" + ], + "path": [ + "api", + "s", + "listenbrainz", + "1", + "submit-listens" + ] + } + }, + "response": [] + } + ] + }, + { + "name": "Scrobble Audioscrobbler", + "item": [ + { + "name": "JSON", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "name": "Content-Type", + "value": "application/json", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"method\":\"track.scrobble\",\n\t\"artist\":\"{{data.artist1}}\",\n\t\"track\":\"{{data.title1}}\",\n\t\"sk\":\"{{session_key}}\"\n}" + }, + "url": { + "raw": "{{url}}/apis/audioscrobbler/2.0/", + "host": [ + "{{url}}" + ], + "path": [ + "apis", + "audioscrobbler", + "2.0", + "" + ] + } + }, + "response": [] + }, + { + "name": "JSON Redirect", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "name": "Content-Type", + "type": "text", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"method\":\"track.scrobble\",\n\t\"artist\":\"{{data.artist1}}\",\n\t\"track\":\"{{data.title1}}\",\n\t\"sk\":\"{{session_key}}\"\n}" + }, + "url": { + "raw": "{{url}}/api/s/audioscrobbler/2.0/", + "host": [ + "{{url}}" + ], + "path": [ + "api", + "s", + "audioscrobbler", + "2.0", + "" + ] + } + }, + "response": [] + }, + { + "name": "Authorize", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var data = JSON.parse(responseBody);", + "pm.environment.set(\"session_key\", data.session.key);", + "tests[\"gotkey\"] = true;" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "name": "Content-Type", + "value": "application/json", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"method\":\"auth.getMobileSession\",\n\t\"authToken\":\"abc\",\n\t\"username\":\"someguy\",\n\t\"password\":\"{{api_key}}\"\n}" + }, + "url": { + "raw": "{{url}}/apis/audioscrobbler/2.0/", + "host": [ + "{{url}}" + ], + "path": [ + "apis", + "audioscrobbler", + "2.0", + "" + ] + } + }, + "response": [] + } + ] + }, + { + "name": "Scrobble Audioscrobbler Legacy", + "item": [ + { + "name": "Authorize", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var data = responseBody.split(\"\\n\");", + "", + "pm.environment.set(\"session_key\", data[1]);", + "pm.environment.set(\"scrobble_url\", data[3]);" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "apikey = pm.variables.get(\"api_key\");", + "ts = pm.variables.get(\"data.timestamp1\");", + "", + "token = CryptoJS.MD5(CryptoJS.MD5(apikey) + ts).toString()", + "pm.environment.set(\"legacy_token\", token);" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{url}}/apis/audioscrobbler_legacy/?hs=true&t={{data.timestamp1}}&a={{legacy_token}}", + "host": [ + "{{url}}" + ], + "path": [ + "apis", + "audioscrobbler_legacy", + "" + ], + "query": [ + { + "key": "hs", + "value": "true" + }, + { + "key": "t", + "value": "{{data.timestamp1}}" + }, + { + "key": "a", + "value": "{{legacy_token}}" + } + ] + } + }, + "response": [] + }, + { + "name": "Scrobble", + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{scrobble_url}}?s={{session_key}}&a[0]={{data.artist1}}&t[0]={{data.title1}}&a[1]={{data.artist2}}&t[1]={{data.title2}}&i[0]={{data.timestamp1}}&i[1]={{data.timestamp2}}", + "host": [ + "{{scrobble_url}}" + ], + "query": [ + { + "key": "s", + "value": "{{session_key}}" + }, + { + "key": "a[0]", + "value": "{{data.artist1}}" + }, + { + "key": "t[0]", + "value": "{{data.title1}}" + }, + { + "key": "a[1]", + "value": "{{data.artist2}}" + }, + { + "key": "t[1]", + "value": "{{data.title2}}" + }, + { + "key": "i[0]", + "value": "{{data.timestamp1}}" + }, + { + "key": "i[1]", + "value": "{{data.timestamp2}}" + } + ] + } + }, + "response": [] + } + ] } ] }, { - "name": "Scrobble Audioscrobbler", + "name": "Metadata", "item": [ { - "name": "JSON", - "event": [ + "name": "Spotify", + "item": [ { - "listen": "test", - "script": { - "exec": [ - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "prerequest", - "script": { - "exec": [ - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "name": "Content-Type", - "value": "application/json", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"method\":\"track.scrobble\",\n\t\"artist\":\"{{example_artist}}\",\n\t\"track\":\"{{example_song}}\",\n\t\"sk\":\"{{session_key}}\"\n}" - }, - "url": { - "raw": "{{url}}/apis/audioscrobbler/2.0/", - "host": [ - "{{url}}" + "name": "Authorize", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "apiid = pm.collectionVariables.get(\"external.spotify.api_id\");", + "apisecret = pm.collectionVariables.get(\"external.spotify.api_secret\");", + "", + "authb64 = new Buffer(apiid + ':' + apisecret).toString('base64');", + "pm.environment.set(\"authb64\", authb64);", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "var data = JSON.parse(responseBody);", + "pm.collectionVariables.set(\"external.spotify.access_token\", data.access_token);" + ], + "type": "text/javascript" + } + } ], - "path": [ - "apis", - "audioscrobbler", - "2.0", - "" - ] - } - }, - "response": [] - }, - { - "name": "JSON Redirect", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "" + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "Basic {{authb64}}", + "type": "text" + } ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "name": "Content-Type", - "type": "text", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"method\":\"track.scrobble\",\n\t\"artist\":\"{{example_artist}}\",\n\t\"track\":\"{{example_song}}\",\n\t\"sk\":\"{{session_key}}\"\n}" + "body": { + "mode": "urlencoded", + "urlencoded": [ + { + "key": "grant_type", + "value": "client_credentials", + "type": "text" + } + ] + }, + "url": { + "raw": "https://accounts.spotify.com/api/token", + "protocol": "https", + "host": [ + "accounts", + "spotify", + "com" + ], + "path": [ + "api", + "token" + ] + } + }, + "response": [] }, - "url": { - "raw": "{{url}}/api/s/audioscrobbler/2.0/", - "host": [ - "{{url}}" - ], - "path": [ - "api", - "s", - "audioscrobbler", - "2.0", - "" - ] - } - }, - "response": [] - }, - { - "name": "Authorize", - "event": [ { - "listen": "test", - "script": { - "exec": [ - "var data = JSON.parse(responseBody);", - "postman.setEnvironmentVariable(\"session_key\", data.session.key);", - "", - "tests[\"gotkey\"] = true;" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "name": "Content-Type", - "value": "application/json", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"method\":\"auth.getMobileSession\",\n\t\"authToken\":\"abc\",\n\t\"username\":\"someguy\",\n\t\"password\":\"{{api_key}}\"\n}" + "name": "Track Info Old", + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "https://api.spotify.com/v1/search?type=track&access_token={{external.spotify.access_token}}&q=artist:{{data.artist3}} track:{{data.title3}}", + "protocol": "https", + "host": [ + "api", + "spotify", + "com" + ], + "path": [ + "v1", + "search" + ], + "query": [ + { + "key": "type", + "value": "track" + }, + { + "key": "access_token", + "value": "{{external.spotify.access_token}}" + }, + { + "key": "q", + "value": "artist:{{data.artist3}} track:{{data.title3}}" + } + ] + } + }, + "response": [] }, - "url": { - "raw": "{{url}}/apis/audioscrobbler/2.0/", - "host": [ - "{{url}}" - ], - "path": [ - "apis", - "audioscrobbler", - "2.0", - "" - ] + { + "name": "Track Info New", + "request": { + "method": "GET", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{external.spotify.access_token}}", + "type": "text" + } + ], + "url": { + "raw": "https://api.spotify.com/v1/search?type=track&q=artist:{{data.artist3}}%20track:{{data.title3}}", + "protocol": "https", + "host": [ + "api", + "spotify", + "com" + ], + "path": [ + "v1", + "search" + ], + "query": [ + { + "key": "type", + "value": "track" + }, + { + "key": "q", + "value": "artist:{{data.artist3}}%20track:{{data.title3}}" + } + ] + } + }, + "response": [] } - }, - "response": [] + ] } ] }, { - "name": "Scrobble Audioscrobbler Legacy", + "name": "Scrobbleforward", "item": [ { - "name": "Authorize", - "event": [ + "name": "Last.fm", + "item": [ { - "listen": "test", - "script": { - "exec": [ - "var data = responseBody.split(\"\\n\");", - "postman.setEnvironmentVariable(\"session_key\", data[1]);", - "postman.setEnvironmentVariable(\"scrobble_url\", data[3]);" - ], - "type": "text/javascript" - } - }, - { - "listen": "prerequest", - "script": { - "exec": [ - "apikey = pm.variables.get(\"api_key\");", - "ts = pm.variables.get(\"timestamp\");", - "", - "token = CryptoJS.MD5(CryptoJS.MD5(apikey) + ts)", - "postman.setEnvironmentVariable(\"legacy_token\", token);" - ], - "type": "text/javascript" - } - } - ], - "protocolProfileBehavior": { - "disableBodyPruning": true - }, - "request": { - "method": "GET", - "header": [], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{url}}/apis/audioscrobbler_legacy/?hs=true&t={{timestamp}}&a={{legacy_token}}", - "host": [ - "{{url}}" - ], - "path": [ - "apis", - "audioscrobbler_legacy", - "" - ], - "query": [ - { - "key": "hs", - "value": "true" + "name": "Authorize", + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "urlencoded", + "urlencoded": [] }, - { - "key": "t", - "value": "{{timestamp}}" - }, - { - "key": "a", - "value": "{{legacy_token}}" + "url": { + "raw": "https://ws.audioscrobbler.com/2.0/?method=auth.getMobileSession&username={{external.lastfm.username}}&password={{external.lastfm.password}}&api_key={{external.lastfm.api_key}}&api_sig=TODO", + "protocol": "https", + "host": [ + "ws", + "audioscrobbler", + "com" + ], + "path": [ + "2.0", + "" + ], + "query": [ + { + "key": "method", + "value": "auth.getMobileSession" + }, + { + "key": "username", + "value": "{{external.lastfm.username}}" + }, + { + "key": "password", + "value": "{{external.lastfm.password}}" + }, + { + "key": "api_key", + "value": "{{external.lastfm.api_key}}" + }, + { + "key": "api_sig", + "value": "TODO" + } + ] } - ] + }, + "response": [] } - }, - "response": [] - }, - { - "name": "Scrobble", - "request": { - "method": "GET", - "header": [], - "url": { - "raw": "{{scrobble_url}}?s={{session_key}}&a[0]={{example_artist}}&t[0]={{example_song}}&a[1]={{example_artist_2}}&t[1]={{example_song_2}}&i[0]={{timestamp}}&i[1]={{timestamp_2}}", - "host": [ - "{{scrobble_url}}" - ], - "query": [ - { - "key": "s", - "value": "{{session_key}}" - }, - { - "key": "a[0]", - "value": "{{example_artist}}" - }, - { - "key": "t[0]", - "value": "{{example_song}}" - }, - { - "key": "a[1]", - "value": "{{example_artist_2}}" - }, - { - "key": "t[1]", - "value": "{{example_song_2}}" - }, - { - "key": "i[0]", - "value": "{{timestamp}}" - }, - { - "key": "i[1]", - "value": "{{timestamp_2}}" - } - ] - } - }, - "response": [] + ] } ] } @@ -608,8 +815,8 @@ "type": "text/javascript", "exec": [ "var current_timestamp = Math.floor(Date.now() / 1000);", - "postman.setEnvironmentVariable(\"timestamp\", current_timestamp);", - "postman.setEnvironmentVariable(\"timestamp_2\", current_timestamp - 200);" + "pm.collectionVariables.set(\"data.timestamp1\", current_timestamp);", + "pm.collectionVariables.set(\"data.timestamp2\", current_timestamp);" ] } }, @@ -633,20 +840,68 @@ "value": "localdevtestkey" }, { - "key": "example_artist", + "key": "session_key", + "value": "" + }, + { + "key": "data.artist1", "value": "EXID ft. Jeremy Soule" }, { - "key": "example_song", - "value": "Why is the Rum gone?" - }, - { - "key": "example_artist_2", + "key": "data.artist2", "value": "BLACKPINK ft. Tzuyu" }, { - "key": "example_song_2", + "key": "data.artist3", + "value": "TWICE" + }, + { + "key": "data.title1", + "value": "Why is the Rum gone?" + }, + { + "key": "data.title2", "value": "POP/STARS" + }, + { + "key": "data.title3", + "value": "One in a Million" + }, + { + "key": "data.timestamp1", + "value": "" + }, + { + "key": "data.timestamp2", + "value": "" + }, + { + "key": "external.spotify.api_id", + "value": "" + }, + { + "key": "external.spotify.api_secret", + "value": "" + }, + { + "key": "external.spotify.access_token", + "value": "" + }, + { + "key": "external.lastfm.username", + "value": "" + }, + { + "key": "external.lastfm.password", + "value": "" + }, + { + "key": "external.lastfm.api_key", + "value": "" + }, + { + "key": "external.lastfm.secret", + "value": "" } ] } \ No newline at end of file