subscribers
Creates, updates, deletes, gets or lists a subscribers resource.
Overview
| Name | subscribers |
| Type | Resource |
| Id | google.health.subscribers |
Fields
The following fields are returned by SELECT queries:
- list
| Name | Datatype | Description |
|---|---|---|
name | string | Identifier. The resource name of the Subscriber. Format: projects/{project}/subscribers/{subscriber} The {project} ID is a Google Cloud Project ID or Project Number. The {subscriber} ID is user-settable (4-36 characters, matching /a-z/) if provided during creation, or system-generated otherwise (e.g., a UUID). Example (User-settable subscriber ID): projects/my-project/subscribers/my-sub-123 Example (System-generated subscriber ID): projects/my-project/subscribers/a1b2c3d4-e5f6-7890-1234-567890abcdef |
createTime | string (google-datetime) | Output only. The time at which the subscriber was created. |
endpointAuthorization | object | Required. Authorization mechanism for a subscriber endpoint. This is required to ensure the endpoint can be verified. (id: EndpointAuthorization) |
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 CreateSubscriber and UpdateSubscriber calls. See RPC documentation for verification details. |
state | string | Output only. The state of the subscriber. (STATE_UNSPECIFIED, UNVERIFIED, ACTIVE, INACTIVE) |
subscriberConfigs | array | Optional. Configuration for the subscriber. |
updateTime | string (google-datetime) | Output only. The time at which the subscriber was last updated. |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
list | select | projectsId | pageSize, pageToken | Lists all subscribers registered within the owned Google Cloud Project. |
create | insert | projectsId | subscriberId | Registers a new subscriber endpoint to receive notifications. A subscriber represents an application or service that wishes to receive data change notifications for users who have granted consent. Endpoint Verification: For a subscriber to be successfully created, the provided endpoint_uri must be a valid HTTPS endpoint and must pass an automated verification check. The backend will send two HTTP POST requests to the endpoint_uri: 1. Verification with Authorization: * Headers: Includes Content-Type: application/json and Authorization (with the exact value from CreateSubscriberPayload.endpoint_authorization.secret). * Body: {"type": "verification"} * Expected Response: HTTP 201 Created. 2. Verification without Authorization: * Headers: Includes Content-Type: application/json. The Authorization header is OMITTED. * Body: {"type": "verification"} * Expected Response: HTTP 401 Unauthorized or 403 Forbidden. Both tests must pass for the subscriber creation to succeed. If verification fails, the operation will not be completed and an error will be returned. This process ensures the endpoint is reachable and correctly validates the Authorization header. |
patch | update | projectsId, subscribersId | updateMask | Updates the configuration of an existing subscriber, such as the endpoint URI or the data types it's interested in. Endpoint Verification: If the endpoint_uri or endpoint_authorization field is included in the update_mask, the backend will re-verify the endpoint. The verification process is the same as described in CreateSubscriber: 1. Verification with Authorization: POST to the new or existing endpoint_uri with the new or existing Authorization secret. Expects HTTP 201 Created. 2. Verification without Authorization: POST to the endpoint_uri without the Authorization header. Expects HTTP 401 Unauthorized or 403 Forbidden. Both tests must pass using the potentially updated values for the subscriber update to succeed. If verification fails, the update will not be applied, and an error will be returned. |
delete | delete | projectsId, subscribersId | force | Deletes a subscriber registration. This will stop all notifications to the subscriber's endpoint. |
Parameters
Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.
| Name | Datatype | Description |
|---|---|---|
projectsId | string | |
subscribersId | string | |
force | boolean | |
pageSize | integer (int32) | |
pageToken | string | |
subscriberId | string | |
updateMask | string (google-fieldmask) |
SELECT examples
- list
Lists all subscribers registered within the owned Google Cloud Project.
SELECT
name,
createTime,
endpointAuthorization,
endpointUri,
state,
subscriberConfigs,
updateTime
FROM google.health.subscribers
WHERE projectsId = '{{ projectsId }}' -- required
AND pageSize = '{{ pageSize }}'
AND pageToken = '{{ pageToken }}'
;
INSERT examples
- create
- Manifest
Registers a new subscriber endpoint to receive notifications. A subscriber represents an application or service that wishes to receive data change notifications for users who have granted consent. Endpoint Verification: For a subscriber to be successfully created, the provided endpoint_uri must be a valid HTTPS endpoint and must pass an automated verification check. The backend will send two HTTP POST requests to the endpoint_uri: 1. Verification with Authorization: * Headers: Includes Content-Type: application/json and Authorization (with the exact value from CreateSubscriberPayload.endpoint_authorization.secret). * Body: {"type": "verification"} * Expected Response: HTTP 201 Created. 2. Verification without Authorization: * Headers: Includes Content-Type: application/json. The Authorization header is OMITTED. * Body: {"type": "verification"} * Expected Response: HTTP 401 Unauthorized or 403 Forbidden. Both tests must pass for the subscriber creation to succeed. If verification fails, the operation will not be completed and an error will be returned. This process ensures the endpoint is reachable and correctly validates the Authorization header.
INSERT INTO google.health.subscribers (
data__endpointAuthorization,
data__endpointUri,
data__subscriberConfigs,
projectsId,
subscriberId
)
SELECT
'{{ endpointAuthorization }}',
'{{ endpointUri }}',
'{{ subscriberConfigs }}',
'{{ projectsId }}',
'{{ subscriberId }}'
RETURNING
name,
done,
error,
metadata,
response
;
# Description fields are for documentation purposes
- name: subscribers
props:
- name: projectsId
value: "{{ projectsId }}"
description: Required parameter for the subscribers resource.
- name: endpointAuthorization
description: |
Required. Authorization mechanism for the subscriber endpoint. The `secret` within this message is crucial for endpoint verification and for securing webhook notifications.
value:
secret: "{{ secret }}"
secretSet: {{ secretSet }}
- name: endpointUri
value: "{{ endpointUri }}"
description: |
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 `CreateSubscriber` call. See CreateSubscriber RPC documentation for verification details.
- name: subscriberConfigs
description: |
Optional. Configuration for the subscriber.
value:
- dataTypes: "{{ dataTypes }}"
subscriptionCreatePolicy: "{{ subscriptionCreatePolicy }}"
- name: subscriberId
value: "{{ subscriberId }}"
UPDATE examples
- patch
Updates the configuration of an existing subscriber, such as the endpoint URI or the data types it's interested in. Endpoint Verification: If the endpoint_uri or endpoint_authorization field is included in the update_mask, the backend will re-verify the endpoint. The verification process is the same as described in CreateSubscriber: 1. Verification with Authorization: POST to the new or existing endpoint_uri with the new or existing Authorization secret. Expects HTTP 201 Created. 2. Verification without Authorization: POST to the endpoint_uri without the Authorization header. Expects HTTP 401 Unauthorized or 403 Forbidden. Both tests must pass using the potentially updated values for the subscriber update to succeed. If verification fails, the update will not be applied, and an error will be returned.
UPDATE google.health.subscribers
SET
data__endpointAuthorization = '{{ endpointAuthorization }}',
data__name = '{{ name }}',
data__endpointUri = '{{ endpointUri }}',
data__subscriberConfigs = '{{ subscriberConfigs }}'
WHERE
projectsId = '{{ projectsId }}' --required
AND subscribersId = '{{ subscribersId }}' --required
AND updateMask = '{{ updateMask}}'
RETURNING
name,
done,
error,
metadata,
response;
DELETE examples
- delete
Deletes a subscriber registration. This will stop all notifications to the subscriber's endpoint.
DELETE FROM google.health.subscribers
WHERE projectsId = '{{ projectsId }}' --required
AND subscribersId = '{{ subscribersId }}' --required
AND force = '{{ force }}'
;