Forked from kinlane/parse-twitter-bookmarks-api-as-postman-collection-test.js
Created
June 9, 2020 19:01
-
-
Save barbietunnie/d79b393d23dab301cb334882a714cb65 to your computer and use it in GitHub Desktop.
parse-twitter-bookmarks-api-as-postman-collection-test.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var jsonData = pm.response.json(); | |
| var tweets = ''; | |
| var all_links = []; | |
| // list out all our links. | |
| tweets = "<h2>Bookmarks</h2>"; | |
| tweets = tweets + '<ul>'; | |
| var tweet_results = jsonData.globalObjects.tweets; | |
| // loop through all the favorited tweets from this respons | |
| for (const [key, value] of Object.entries(tweet_results)) { | |
| var text = value.full_text; | |
| var url = value.entities.urls; | |
| var id = key; | |
| tweets = tweets + '<li>'; | |
| tweets = tweets + text + ' (tweet id:' + id + ')'; | |
| if(url.length > 0){ | |
| tweets = tweets + text + '<ul>'; | |
| for (var i = 0; i < url.length; i++){ | |
| var expanded_url = url[i].expanded_url; | |
| tweets = tweets + '<li>' + expanded_url + '</li>'; | |
| } | |
| tweets = tweets + '</ul>'; | |
| } | |
| tweets = tweets + '</li>'; | |
| } | |
| tweets = tweets + '</ul>'; | |
| pm.visualizer.set(tweets); | |
| pm.environment.set("favorites",tweets); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment