REST Resource: projects.subscribers

Resource: CreateSubscriberPayload

Payload for creating a subscriber.

JSON representation
{
  "endpointUri": string,
  "subscriberConfigs": [
    {
      object (SubscriberConfig)
    }
  ],
  "endpointAuthorization": {
    object (EndpointAuthorization)
  }
}
Fields
endpointUri

string

Required. The full HTTPS URI where update notifications will be sent. The URI must be a valid URL and use HTTPS as the scheme. This endpoint will be verified during the subscribers.create call. See subscribers.create RPC documentation for verification details.

subscriberConfigs[]

object (SubscriberConfig)

Optional. Configuration for the subscriber.

endpointAuthorization

object (EndpointAuthorization)

Required. Authorization mechanism for the subscriber endpoint. The secret within this message is crucial for endpoint verification and for securing webhook notifications.

SubscriberConfig

Configuration for a subscriber. A notification is sent to a subscription ONLY if the subscriber has a config for the data type.

JSON representation
{
  "dataTypes": [
    string
  ],
  "subscriptionCreatePolicy": enum (SubscriberConfig.SubscriptionCreatePolicy)
}
Fields
dataTypes[]

string

Required. Supported data types are: "altitude", "distance", "floors", "sleep", "steps", "weight". Values should be in kebab-case.

subscriptionCreatePolicy

enum (SubscriberConfig.SubscriptionCreatePolicy)

Required. Policy for subscription creation.

SubscriberConfig.SubscriptionCreatePolicy

Policy for subscription creation.

Enums
SUBSCRIPTION_CREATE_POLICY_UNSPECIFIED Represents an unspecified policy.
AUTOMATIC

When using AUTOMATIC, individual subscriptions are not created or stored. Instead, eligibility for notifications is computed dynamically. When a data update occurs for a given data type, notifications are sent to all subscribers with an AUTOMATIC policy for that data type, provided the user has granted the necessary consents.

This means you do not need to call CreateSubscription for each user; notifications are managed automatically based on user consents. As Subscription resources are not stored, they cannot be retrieved or managed through GetSubscription, ListSubscriptions, UpdateSubscription, or DeleteSubscription.

MANUAL Requires subscriptions to be created manually for new users. The developer needs to call CreateSubscription for new users.

EndpointAuthorization

Authorization mechanism for a subscriber endpoint. For all requests sent by the Webhooks service, the JSON payload is cryptographically signed. The signature is delivered in the X-HEALTHAPI-SIGNATURE HTTP header. This is an ECDSA (NIST P256) signature of the JSON payload. Clients must verify this signature using Google Health API's public key to confirm the payload was sent by the Health API.

JSON representation
{
  "secret": string,
  "secretSet": boolean
}
Fields
secret

string

Required. Input only. Provides a client-provided secret that will be sent with each notification to the subscriber endpoint using the "Authorization" header. The value must include the authorization scheme, e.g., "Bearer " or "Basic ", as it will be used as the full Authorization header value. This secret is used by the API to test the endpoint during subscribers.create and subscribers.patch calls, and will be sent in the Authorization header for all subsequent webhook notifications to this endpoint.

secretSet

boolean

Output only. Whether the secret is set.

Methods

create

Registers a new subscriber endpoint to receive notifications.

delete

Deletes a subscriber registration.

list

Lists all subscribers registered within the owned Google Cloud Project.

patch

Updates the configuration of an existing subscriber, such as the endpoint URI or the data types it's interested in.