Replies: 8 comments 14 replies
-
|
So if I am understanding this correctly in order to use environment variables in flows I have to set the environment on each block. So if I have a complex flow and want to change environments I have to manually change each block independently? Variable script blocks do not have an environment drop-down either so I have to use a mixed mode of flow variables and request variables if I want to use any environment variables? Do you have any plans for being able to change the environment for every block in the flow? This feels like a step back in the idea of being able to create 1 flow and use it in multiple environments which we have in collections. Please advise if I am not understanding this. |
Beta Was this translation helpful? Give feedback.
-
|
I suggest referring to vuex, behavior and state need to be separated |
Beta Was this translation helpful? Give feedback.
-
|
I agree. The change number 2 above is a huge step backward. "The environment selection for the workspace has no effect on the entire flows." We now have to change each block in the entire flow. It used to be intuitive and easy. Now it is cumbersome and error-prone. I now have to change the environment in every block. If I accidentally miss a block, I will get incorrect data. |
Beta Was this translation helpful? Give feedback.
-
|
@saswatds Why not allow the user to select "Use global environment" on each block? That way it is completely flexible. We can use it the way it used to be, or we could customize each block. |
Beta Was this translation helpful? Give feedback.
-
Test script: Is there any method so I can parse manipulate as I want all Html responses in Flows.
|
Beta Was this translation helpful? Give feedback.
-
|
@saswatds is it possible to write some warning to console when trying to update a read-only Environment/Global variable in Flows? As for me, it would help users to understand why post-request test is passing, but the variables does not get updated. |
Beta Was this translation helpful? Give feedback.
-
|
Definitely needs some explanation on updating variables since I just spent 20 minutes trying to figure this out. What's the suggested process when you need to ensure you have a valid authentication token? Put the same blocks in every flow? Run requests manually to get the token into the environment and then use that in flows? Was hoping to create a flow like:
and then I have a token for all further requests, which they use as part of the headers they send (bearer token). It would be nice to call a flow from another flow and use flow_1 output as initial input to flow_2 - that might work in this case to avoid writing to the environment or having to recreate token flow blocks in every flow. For the above scenario, all I can see as a solution is run all the token requests manually to get the environment set up, then use flows since they can read the environment. I'm definitely not duplicating the same token logic across flows and I don't see that you can chain flows. Collection runners don't seem to handle conditionals - maybe in the pre-request and testing scripts? But would the scripting for a collection run interfere with using a request individually? Am I missing something in how to approach this? If you want to discourage use of environment and global variables then it needs to be simple to get something like a token and re-use it across flows. I don't see that as possible right now without using environment / global variables or re-creating the same blocks in every flow. |
Beta Was this translation helpful? Give feedback.
-
|
"Flows" has lots of defects. As i see it at the moment, the idea of "Flows" is awesome, the implementation is unusable |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I want to begin by saying that nothing is wrong with environments or variables. They just work differently in Flows from how they used to work in the Collection Runner or the Request Tab.
Here are the three differences that you might notice when working with flows.
Environment variables can only be used within a request. Variables are not first-class citizens in Flows.
When request templating with
{{variable}}was introduced, environments were provided as a means to store sensitive information like API Keys, session tokens, etc. The word environment variable was also chosen because it correlated with operating system environment variables. An environment variable is a simple key-value pair where both keys and values are strings to store information that dictate how the API should behave in different environments like beta, stage, production, etc.When the collection runner was introduced, by accident, we realised that using a pre-request script, test script and the
postman.setNextRequestAPI, and we could build a simple Turing machine language with collections. The only problem was that this language did not have an runtime-environment with a scope spanned across multiple requests. Using environment variables seemed like an easy escape hatch to this issue, and the sandbox added support for APIs to update the environment variable.Inevitably the problem arose that sensitive data or values that were never supposed to be updated could now get over-written during execution. Therefore we had to introduce the concept of current and initial values in environments. You can realise that this early decision of using environment variables for something that was never intended to be used has been the epicentre of all confusion and problems.
When we started designing flow language, we added an environment within the language itself. This means that users no longer had to piggyback on the environment variables to send data from one request to another request. They could do it just by connecting two blocks with a connection.
It was a difficult decision to break the existing pattern, but we firmly believe this is a necessary change as it would simplify problems for both us and users.
The environment selection for the workspace has no effect on the entire flows.
Another design decision that we made with flows was allowing execution requests that belonged to a different collection. We wanted flows to grow to become the de-facto for expressing workflows and collections to be an executable specification of an API.
The traditional way of representing workflows in a collection meant that collections were no longer a homogenous set of APIs but a mismatch of different APIs, which only make sense in the context of that collection. This way of organisation resulted in the emergence of two kinds of collections, one that was reference-grade material but could not be executed, and the other that was executable but hard to comprehend as a specification.
Because flows allow running requests across various collections, having a single selection of environments for the entire flow would mean that flows would not allow interfacing APIs hosted in different environments. Therefore, we decided that the environment selection for the entire flow will not be respected, but we will want users to select an environment for each Request block explicitly.
Environment works in a read-only mode, updates to the environment from scripts are not respected.
Expanding on the points raised above in section 1, we want to discourage the usage of environment variables as a storage mechanism. For this reason, environment variables and globals are now treated as read-only values, and any updates made to them through script are not respected. Another reason for enforcing this is to use this opportunity to identify the loose end of the flow language and its ability to provide a robust environment implementation that we have not been able to do with postman for a long time.
How should you work with these new differences?
I want to use information from the response of one request in another request.

I want to use information from the response of one request in multiple requests.

I want to use information from the response of one request in multiple requests but control the order in which requests are executed.

Beta Was this translation helpful? Give feedback.
All reactions