For clarity, all the API calls really are RESTful, meaning
- Every call is stateless, and is independent from any other REST API call (past or future), and from whatever else is going on with sessions logged into the UI
- Because they are stateless, every call must contain enough information for Matillion to respond
So for example, if you make a REST call and ask "Give me the Environment name", the call will fail because it won't know which Environment you mean.
And you can't tell it "Give me the Environment name, and I mean the one I am (or was) logged into in the UI". The call will still fail, because it's deliberately not permitted to infer anything from whatever may or may not be going on with sessions logged into the UI.
As you can probably guess, you also can't tell it "Give me the Environment name, and I mean the one I specified in a previous API call"... for similar reasons.
So, here's a summary of the endpoints we have been discussing:
/rest/v1/group/name/<group>/project/name/<project>/environment
Valid and returns an array of all the Environments.
You're not asking for any one in particular, and there can be more than one.
/rest/v1/group/name/<group>/project/name/<project>/environment/name
Not a valid endpoint, and fails with a 404. The /name on the end implies that an Environment name must follow.
/rest/v1/group/name/<group>/project/name/<project>/environment/name/<envname>
Not a valid endpoint, because you have not declared what information you want back about the Environment
Arguably we could have made it return some chunk of JSON. But as it is, it (rather confusingly) succeeds and returns a big JSON description of the valid endpoints
/rest/v1/group/name/<group>/project/name/<project>/environment/name/<envname>/name
Vaild, and returns the Name of the Environment
/rest/v1/group/name/<group>/project/name/<project>/environment/name/<envname>/id
Vaild, and returns the ID of the Environment
Hope that makes sense and is helpful!
Ian