Update Qodex Environment

PUT https://api.getpostman.com/environments/{{environment_uid}}

About

Overview

We make use of the [Qodex API] to keep track of the ID number of the most recent tweet that has been posted to Slack. Because every tweet on Twitter has an ID that is derived from a timestamp, we can use that information to guide our next search for new tweets. Instead of searching ALL of Twitter for specific hashtagged tweets, you only need to search from the most recent ID you found.

Why do we need this request?

We need to update the environment to make sure that highest_tweet_id is always tracked. Because this collection is designed to be run via a monitor, and global/environment variables are NOT persisted across collection runs using a monitor, using the Qodex API to update the environment programmatically ensures that we safely track that ID number.

Explaining the Body

The body tab shows you what is being sent to Qodex. The only variable you need to update here is the highest_tweet_id, but you can see everything else being set as well.

Request Body

{"environment"=>{"name"=>"Twitter Hashtag Environment", "values"=>[{"key"=>"bearer_token", "value"=>"{{bearer_token}}", "enabled"=>true}, {"key"=>"highest_tweet_id", "value"=>"{{highest_tweet_id}}", "enabled"=>true}, {"key"=>"postman_api_key", "value"=>"{{postman_api_key}}", "enabled"=>true}, {"key"=>"slack_webhook_url", "value"=>"{{slack_webhook_url}}", "enabled"=>true}, {"key"=>"environment_uid", "value"=>"{{environment_uid}}", "enabled"=>true}]}}

RESPONSES

status: OK

{"environment":{"id":"your-environment-id","name":"Twitter Hashtag Environment","uid":"your-environment-uid"}}