Ana içeriğe geç

Get Environments by Project

Endpoint​

GET /apiops/projects/{projectName}/environments/

Authentication​

Requires a Personal API Access Token.

Authorization: Bearer YOUR_TOKEN

Request​

Headers​

HeaderValueRequired
AuthorizationBearer {token}Yes

Path Parameters​

ParameterTypeRequiredDescription
projectNamestringYesProject name

Query Parameters​

None.

Response​

Success Response (200 OK)​

{
"status": "SUCCESS",
"resultList": [
{
"id": "60a7b1c2d3e4f5g6h7i8j9k0",
"name": "production",
"description": "Production environment",
"type": "PRODUCTION",
"accessUrl": "https://gw.example.com",
"status": "PUBLISHED",
"deployed": null,
"redeployRequired": null
},
{
"id": "60a7b1c2d3e4f5g6h7i8j9k1",
"name": "staging",
"description": "Staging environment",
"type": "SANDBOX",
"accessUrl": "https://gw-staging.example.com",
"status": "PUBLISHED",
"deployed": null,
"redeployRequired": null
}
],
"resultCount": 2
}

Response Fields​

FieldTypeDescription
statusstringResponse status: SUCCESS or FAILURE
resultListarray[object]List of environments accessible from the project
resultCountintegerTotal number of environments

Environment Object​

FieldTypeDescription
idstringEnvironment unique identifier
namestringEnvironment name
descriptionstringEnvironment description (optional)
typestringEnvironment type. See EnumEnvironmentType
accessUrlstringGateway access URL for this environment
statusstringPublish status. See EnumPublishStatus
deployedbooleanWhether the environment is deployed (only populated in API Proxy/Group context)
redeployRequiredbooleanWhether redeployment is required (only populated in API Proxy/Group context)

EnumEnvironmentType​

  • PRODUCTION - Production environment
  • SANDBOX - Sandbox/staging environment
  • TEST - Test environment

EnumPublishStatus​

  • UNPUBLISHED - Environment is not published
  • PUBLISHED - Environment is published and active
  • REPUBLISH_REQUIRED - Environment needs to be republished due to configuration changes

Error Response (400 Bad Request)​

Returned when the project is not found or the user does not have access to the project:

{
"status": "FAILURE",
"resultMessage": "Project (MyProject) is not found or user does not have privilege to access it!"
}

Error Response (401 Unauthorized)​

{
"status": "FAILURE",
"resultMessage": "Invalid or expired token"
}

cURL Example​

curl -X GET \
"https://demo.apinizer.com/apiops/projects/MyProject/environments/" \
-H "Authorization: Bearer YOUR_TOKEN"

Permissions​

  • User must have any permission in the project (read access)

Notes and Warnings​

  • Project Membership: User must have any permission in the project
  • Access errors: Project not found or insufficient access returns 400 Bad Request, not 403 Forbidden