Using the Payload Event Pull API

The Payload Event Pull API lets integration consumers retrieve or regenerate pub/sub payloads on demand, without waiting for a business event to trigger a push notification. There are four endpoints covering common integration recovery and discovery scenarios.

Prerequisites

  • Before you can use the API your System Administrator must enable the PAYLOAD_EVENT_PULL_API Feature Toggle.

  • You have configured at least one active pub/sub payload. For more information, see Publish/Subscribe Framework.

Typical Integration Flow

  1. Call the OAuth 2.0 token endpoint to obtain a bearer token for your tenant.

  2. Call GET /payloadpublishsubscribe to see which payload IDs are active for your company.

  3. Call POST /generate with an object ID and payload ID to generate a payload on demand.

  4. Call POST /events with a <payloadTransportId> to retrieve a stored payload and replay a missed push.

  5. For FGLS objects, call POST /generate-by-refs with object reference strings. No payload ID is needed.

Obtain a Bearer Token

The Pull API provides four endpoints. All endpoints require an OAuth 2.0 Bearer token (AccessTokenV2) in the <Authorization> header. SAP Fieldglass resolves the caller's identity and company automatically from the token. No <companyCode> or <userId> is required.

To obtain a token, submit the following request to the authorization server using the <client_credentials> grant flow:

POST https://{tenant}.fieldglass.net/oauth2/v2.0/token
Content-Type: application/x-www-form-urlencoded

grant_type=client_credentials
&client_id=<your-client-id>
&client_secret=<your-client-secret>
&scope=api

The response includes an access_token. Pass this value as the bearer token on all API requests:

Authorization: Bearer <access_token>

Examples

Base URL: https://{tenant}.fieldglass.net/api/v1

Endpoint 1: List active pub/sub payload configurations

Use this endpoint to discover which payload IDs are active for your company and which webhook endpoints each configuration delivers to. The payload ID values returned here can be used directly as inputs to Endpoints 3.

Method: GET /payloadevent/v1/payloadpublishsubscribe

Endpoint 2: Retrieve stored payloads by event ID

Use this endpoint to confirm or to retrieve the payload. Provide the payloadTransportId from the original push notification envelope. The system returns the stored payload as-is, including push status, timestamps, retry count, and the full payload body. No payload regeneration occurs.

Method: POST /payloadevent/v1/events

Endpoint 3: Generate a payload on demand

Use this endpoint to get the current state of a document without waiting for the next business event. Provide an object ID (the SAP Fieldglass document identifier) and a payload ID (the payload configuration to use). The system generates a fresh payload at runtime. Use Endpoint 4 to discover the valid payloadId for your company.

Method: POST /payloadevent/v1/generate

Endpoint 4: Generate FGLS payloads by object reference (FGLS integrations only)

Use this endpoint for FGLS integrations when you have an object reference string but not a payload ID. The system probes all active FGLS payload configurations to determine which payload applies to each reference and returns the generated payloads. Object references that don't match an active configuration are silently omitted from the response.

Method: POST /payloadevent/v1/generate-by-refs

Restrictions

  • Endpoint 2 returns the stored payload exactly as it was at the time of the original push event. Objects that have never triggered a pub/sub event do not have a payloadTransportId and cannot be used with Endpoint 2.

  • Endpoint 4 (generate by object reference) is designed for users who don't have the configuration or just need a standard payload.

  • All four endpoints return HTTP 503 when the PAYLOAD_EVENT_PULL_API feature toggle is disabled.

  • Cross-company access is not permitted. Requests referencing objects belonging to a different company return HTTP 403. In Endpoint 4, object references from a different company are silently omitted from the response without returning an error.