Change
For instructions on how to authenticate to use this endpoint, see API overview.
Endpoints
GET | |
GET | |
POST | |
POST | |
POST |
List all change requests
Required API key scopes
approvals:readPath parameters
- project_idstring
Query parameters
- action_keystring
- limitinteger
- offsetinteger
- requesternumber
- resource_idstring
- resource_typestring
- statearray
Response
Example request
GET /api /environments /:project_id /change_requestsexport POSTHOG_PERSONAL_API_KEY=[your personal api key]curl \-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \<ph_app_host>/api/environments/:project_id/change_requests/
api_key = "[your personal api key]"project_id = "[your project id]"response = requests.get("<ph_app_host>/api/environments/{project_id}/change_requests/".format(project_id=project_id),headers={"Authorization": "Bearer {}".format(api_key)},).json()
Example response
Status 200
RESPONSE
{"count": 123,"next": "http://api.example.org/accounts/?offset=400&limit=100","previous": "http://api.example.org/accounts/?offset=200&limit=100","results": [{"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08","action_key": "string","action_version": 0,"resource_type": "string","resource_id": "string","intent": null,"intent_display": null,"policy_snapshot": null,"validation_status": "valid","validation_errors": null,"validated_at": "2019-08-24T14:15:22Z","state": "pending","created_by": {"id": 0,"uuid": "095be615-a8ad-4c33-8e9c-c7612fbf6c9f","distinct_id": "string","first_name": "string","last_name": "string","email": "user@example.com","is_email_verified": true,"hedgehog_config": {"property1": null,"property2": null},"role_at_organization": "engineering"},"applied_by": {"id": 0,"uuid": "095be615-a8ad-4c33-8e9c-c7612fbf6c9f","distinct_id": "string","first_name": "string","last_name": "string","email": "user@example.com","is_email_verified": true,"hedgehog_config": {"property1": null,"property2": null},"role_at_organization": "engineering"},"created_at": "2019-08-24T14:15:22Z","updated_at": "2019-08-24T14:15:22Z","expires_at": "2019-08-24T14:15:22Z","applied_at": "2019-08-24T14:15:22Z","apply_error": "string","result_data": null,"approvals": [{"property1": null,"property2": null}],"can_approve": true,"can_cancel": true,"is_requester": true,"user_decision": "string"}]}
Retrieve change requests
Required API key scopes
approvals:readPath parameters
- idstring
- project_idstring
Response
Example request
GET /api /environments /:project_id /change_requests /:idexport POSTHOG_PERSONAL_API_KEY=[your personal api key]curl \-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \<ph_app_host>/api/environments/:project_id/change_requests/:id/
api_key = "[your personal api key]"project_id = "[your project id]"response = requests.get("<ph_app_host>/api/environments/{project_id}/change_requests/{change_request_id}/".format(project_id=project_id,change_request_id="<the change request id>"),headers={"Authorization": "Bearer {}".format(api_key)},).json()
Example response
Status 200
RESPONSE
{"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08","action_key": "string","action_version": 0,"resource_type": "string","resource_id": "string","intent": null,"intent_display": null,"policy_snapshot": null,"validation_status": "valid","validation_errors": null,"validated_at": "2019-08-24T14:15:22Z","state": "pending","created_by": {"id": 0,"uuid": "095be615-a8ad-4c33-8e9c-c7612fbf6c9f","distinct_id": "string","first_name": "string","last_name": "string","email": "user@example.com","is_email_verified": true,"hedgehog_config": {"property1": null,"property2": null},"role_at_organization": "engineering"},"applied_by": {"id": 0,"uuid": "095be615-a8ad-4c33-8e9c-c7612fbf6c9f","distinct_id": "string","first_name": "string","last_name": "string","email": "user@example.com","is_email_verified": true,"hedgehog_config": {"property1": null,"property2": null},"role_at_organization": "engineering"},"created_at": "2019-08-24T14:15:22Z","updated_at": "2019-08-24T14:15:22Z","expires_at": "2019-08-24T14:15:22Z","applied_at": "2019-08-24T14:15:22Z","apply_error": "string","result_data": null,"approvals": [{"property1": null,"property2": null}],"can_approve": true,"can_cancel": true,"is_requester": true,"user_decision": "string"}
Create change requests approve
Approve a change request. If quorum is reached, automatically applies the change immediately.
Required API key scopes
approvals:writePath parameters
- idstring
- project_idstring
Request parameters
Response
Example request
POST /api /environments /:project_id /change_requests /:id /approveexport POSTHOG_PERSONAL_API_KEY=[your personal api key]curl-H 'Content-Type: application/json'\-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \<ph_app_host>/api/environments/:project_id/change_requests/:id/approve/\-d action_key="string"
api_key = "[your personal api key]"project_id = "[your project id]"response = requests.post("<ph_app_host>/api/environments/{project_id}/change_requests/{change_request_id}/approve/".format(project_id=project_id,change_request_id="<the change request id>"),headers={"Authorization": "Bearer {}".format(api_key)},data={"action_key": "string"}).json()
Example response
Status 200
RESPONSE
{"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08","action_key": "string","action_version": 0,"resource_type": "string","resource_id": "string","intent": null,"intent_display": null,"policy_snapshot": null,"validation_status": "valid","validation_errors": null,"validated_at": "2019-08-24T14:15:22Z","state": "pending","created_by": {"id": 0,"uuid": "095be615-a8ad-4c33-8e9c-c7612fbf6c9f","distinct_id": "string","first_name": "string","last_name": "string","email": "user@example.com","is_email_verified": true,"hedgehog_config": {"property1": null,"property2": null},"role_at_organization": "engineering"},"applied_by": {"id": 0,"uuid": "095be615-a8ad-4c33-8e9c-c7612fbf6c9f","distinct_id": "string","first_name": "string","last_name": "string","email": "user@example.com","is_email_verified": true,"hedgehog_config": {"property1": null,"property2": null},"role_at_organization": "engineering"},"created_at": "2019-08-24T14:15:22Z","updated_at": "2019-08-24T14:15:22Z","expires_at": "2019-08-24T14:15:22Z","applied_at": "2019-08-24T14:15:22Z","apply_error": "string","result_data": null,"approvals": [{"property1": null,"property2": null}],"can_approve": true,"can_cancel": true,"is_requester": true,"user_decision": "string"}
Create change requests cancel
Cancel a change request. Only the requester can cancel their own pending change request.
Required API key scopes
approvals:writePath parameters
- idstring
- project_idstring
Request parameters
Response
Example request
POST /api /environments /:project_id /change_requests /:id /cancelexport POSTHOG_PERSONAL_API_KEY=[your personal api key]curl-H 'Content-Type: application/json'\-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \<ph_app_host>/api/environments/:project_id/change_requests/:id/cancel/\-d action_key="string"
api_key = "[your personal api key]"project_id = "[your project id]"response = requests.post("<ph_app_host>/api/environments/{project_id}/change_requests/{change_request_id}/cancel/".format(project_id=project_id,change_request_id="<the change request id>"),headers={"Authorization": "Bearer {}".format(api_key)},data={"action_key": "string"}).json()
Example response
Status 200
RESPONSE
{"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08","action_key": "string","action_version": 0,"resource_type": "string","resource_id": "string","intent": null,"intent_display": null,"policy_snapshot": null,"validation_status": "valid","validation_errors": null,"validated_at": "2019-08-24T14:15:22Z","state": "pending","created_by": {"id": 0,"uuid": "095be615-a8ad-4c33-8e9c-c7612fbf6c9f","distinct_id": "string","first_name": "string","last_name": "string","email": "user@example.com","is_email_verified": true,"hedgehog_config": {"property1": null,"property2": null},"role_at_organization": "engineering"},"applied_by": {"id": 0,"uuid": "095be615-a8ad-4c33-8e9c-c7612fbf6c9f","distinct_id": "string","first_name": "string","last_name": "string","email": "user@example.com","is_email_verified": true,"hedgehog_config": {"property1": null,"property2": null},"role_at_organization": "engineering"},"created_at": "2019-08-24T14:15:22Z","updated_at": "2019-08-24T14:15:22Z","expires_at": "2019-08-24T14:15:22Z","applied_at": "2019-08-24T14:15:22Z","apply_error": "string","result_data": null,"approvals": [{"property1": null,"property2": null}],"can_approve": true,"can_cancel": true,"is_requester": true,"user_decision": "string"}
Create change requests reject
Reject a change request.
Required API key scopes
approvals:writePath parameters
- idstring
- project_idstring
Request parameters
Response
Example request
POST /api /environments /:project_id /change_requests /:id /rejectexport POSTHOG_PERSONAL_API_KEY=[your personal api key]curl-H 'Content-Type: application/json'\-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \<ph_app_host>/api/environments/:project_id/change_requests/:id/reject/\-d action_key="string"
api_key = "[your personal api key]"project_id = "[your project id]"response = requests.post("<ph_app_host>/api/environments/{project_id}/change_requests/{change_request_id}/reject/".format(project_id=project_id,change_request_id="<the change request id>"),headers={"Authorization": "Bearer {}".format(api_key)},data={"action_key": "string"}).json()
Example response
Status 200
RESPONSE
{"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08","action_key": "string","action_version": 0,"resource_type": "string","resource_id": "string","intent": null,"intent_display": null,"policy_snapshot": null,"validation_status": "valid","validation_errors": null,"validated_at": "2019-08-24T14:15:22Z","state": "pending","created_by": {"id": 0,"uuid": "095be615-a8ad-4c33-8e9c-c7612fbf6c9f","distinct_id": "string","first_name": "string","last_name": "string","email": "user@example.com","is_email_verified": true,"hedgehog_config": {"property1": null,"property2": null},"role_at_organization": "engineering"},"applied_by": {"id": 0,"uuid": "095be615-a8ad-4c33-8e9c-c7612fbf6c9f","distinct_id": "string","first_name": "string","last_name": "string","email": "user@example.com","is_email_verified": true,"hedgehog_config": {"property1": null,"property2": null},"role_at_organization": "engineering"},"created_at": "2019-08-24T14:15:22Z","updated_at": "2019-08-24T14:15:22Z","expires_at": "2019-08-24T14:15:22Z","applied_at": "2019-08-24T14:15:22Z","apply_error": "string","result_data": null,"approvals": [{"property1": null,"property2": null}],"can_approve": true,"can_cancel": true,"is_requester": true,"user_decision": "string"}