Checking Status

This page describes how to use Google Service Control for checking status on services, service producers, service consumers, and API keys.

When a service producer offers a service to its service consumers, it needs to ensure that various preconditions are met, such as whether a consumer has been deleted or whether the consumer has enabled the service or whether an API key is valid.

Service Control provides a simple services.check method to check such preconditions. A service should call this method on a regular basis to ensure the preconditions are met. The activity between the producer and the consumer is represented by an Operation. The services.check method performs the following checks on the operation:

  • The producer project is live and in a healthy state.
  • The consumer project is live and in a healthy state.
  • The service is enabled on the consumer project.
  • The API key is valid.
  • The use of the API key satisfies restrictions associated with the API key, such as IP or HTTP referrer restrictions.

The services.check method is typically called from the servers that actually implement the service. For security and privacy purposes, Service Control uses Google Cloud IAM to verify the caller has the proper permission to call the method. See Access Control for details.

Checking status

Once you have published a managed service to Google Service Management, you can call the services.check method on the service without additional configuration. See the services.check reference for details.

To quickly experiment with the method, you can use the gcurl command to call the services.check method. See Getting Started for the initial setup steps.

gcurl -d '{
  "operation": {
    "operationId": "123e4567-e89b-12d3-a456-426655440000",
    "consumerId": "project:endpointsapis-consumer",
  "operationId": "123e4567-e89b-12d3-a456-426655440000"

The response from the check method indicates whether all checks succeeded or some checks failed. Success is indicated by the absence of checkErrors field. Otherwise, the checkErrors field will list the failed checks.

Was this page helpful? Let us know how we did: