workday

package
v1.86.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 23, 2026 License: BSD-3-Clause Imports: 22 Imported by: 0

README

Workday Adapter

Entity External IDs

The Entity External ID maps to a WQL (Workday Query Language) table name. The adapter constructs URLs as:

{baseURL}/api/wql/{apiVersion}/{organizationID}/data?limit={pageSize}&offset={offset}&query={WQL}

The WQL query uses the entity external ID in the FROM clause:

SELECT {columns} FROM {entityExternalID} [ORDER BY {uniqueIdColumn} ASC]

The adapter is open-ended - any valid WQL table name can be used as an entity external ID.

Entity External ID WQL Table Description
allWorkers allWorkers All worker records

Attribute External IDs

Attributes use either plain column names or JSONPath expressions:

Format Example WQL Column
Plain name employeeID employeeID
JSONPath $.worker.id worker (first path segment)
JSONPath $.managementLevel.descriptor managementLevel
JSONPath array $.email_Work[0].descriptor email_Work

The AttrExternalIDToColumnName function converts JSONPath attributes to their top-level column name for the SELECT clause.

Example

Entity External ID allWorkers with various attributes produces:

https://instance.workday.com/api/wql/v1/SGNL/data?limit=100&offset=0&query=SELECT+FTE,+company,+email_Work,+employeeID,+gender,+hireDate,+jobTitle,+managementLevel,+positionID,+worker,+workerActive+FROM+allWorkers

Notes

  • The only supported API version is v1.
  • Max page size is 1000.
  • Child entity external IDs (e.g., email_Work) are included as columns in the parent's SELECT query.
  • Columns are sorted alphabetically in the SELECT clause.

Adding New Entity External IDs

No code changes required. The adapter places any entity external ID directly into the WQL FROM clause. Simply configure a new entity in SGNL with the WQL table name (e.g., allActiveEmployees, allCompanies, allLocations) and it will work.

To find valid WQL table names, refer to Workday's WQL Data Dictionary or use the Workday REST API to list available data sources.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AttrExternalIDToColumnName

func AttrExternalIDToColumnName(externalID string) (string, error)

func BuildQuery

func BuildQuery(entity *framework.EntityConfig, ordered bool) (string, *framework.Error)

func ConstructEndpoint

func ConstructEndpoint(request *Request) (string, *framework.Error)

ConstructEndpoint constructs and returns the endpoint to query the datasource.

func NewAdapter

func NewAdapter(client Client) framework.Adapter[Config]

NewAdapter instantiates a new Adapter.

func ParseError

func ParseError(data *DatasourceResponse, endpoint string) *framework.Error

func ParseResponse

func ParseResponse(body []byte, request *Request, endpoint string) (
	objects []map[string]any,
	nextCursor *pagination.CompositeCursor[int64],
	err *framework.Error,
)

Types

type Adapter

type Adapter struct {
	WorkdayClient Client
}

Adapter implements the framework.Adapter interface to query pages of objects from datasources.

func (*Adapter) GetPage

func (a *Adapter) GetPage(ctx context.Context, request *framework.Request[Config]) framework.Response

GetPage is called by SGNL's ingestion service to query a page of objects from a datasource.

func (*Adapter) RequestPageFromDatasource

func (a *Adapter) RequestPageFromDatasource(
	ctx context.Context, request *framework.Request[Config],
) framework.Response

RequestPageFromDatasource requests a page of objects from a datasource.

func (*Adapter) ValidateGetPageRequest

func (a *Adapter) ValidateGetPageRequest(ctx context.Context, request *framework.Request[Config]) *framework.Error

ValidateGetPageRequest validates the fields of the GetPage Request.

type Client

type Client interface {
	GetPage(ctx context.Context, request *Request) (*Response, *framework.Error)
}

Client is a client that allows querying the datasource which contains JSON objects.

func NewClient

func NewClient(client *http.Client) Client

NewClient returns a Client to query the datasource.

type Config

type Config struct {
	// Common configuration
	*config.CommonConfig

	// APIVersion is the version of the Workday API to use.
	APIVersion string `json:"apiVersion,omitempty"`

	// OrganizationID is the ID of the organization in Workday.
	OrganizationID string `json:"organizationId,omitempty"`
}

Config is the configuration passed in each GetPage calls to the adapter. Workday Adapter configuration example: nolint: godot

{
    "requestTimeoutSeconds": 10,
    "localTimeZoneOffset": 43200,
    "apiVersion": "v1",
	"organizationId": "SGNL"
}

func (*Config) Validate

func (c *Config) Validate(_ context.Context) error

ValidateConfig validates that a Config received in a GetPage call is valid.

type Datasource

type Datasource struct {
	Client *http.Client
}

Datasource directly implements a Client interface to allow querying an external datasource.

func (*Datasource) GetPage

func (d *Datasource) GetPage(ctx context.Context, request *Request) (*Response, *framework.Error)

type DatasourceResponse

type DatasourceResponse struct {
	Total   *int64           `json:"total"`
	Objects []map[string]any `json:"data"`
	Error   *string          `json:"error"`
	Errors  []ErrorInfo      `json:"errors"`
}

Workday API response format.

type Entity

type Entity struct {
	// TableName is the name of the entity's table in the datasource.
	TableName string
	// UniqueIDAttrExternalID is the external ID of the entity's uniqueId attribute.
	UniqueIDAttrExternalID string
}

Entity contains entity specific information, such as the entity's unique ID attribute and the endpoint path to query that entity.

type ErrorInfo

type ErrorInfo struct {
	Error    string `json:"error"`
	Field    string `json:"field"`
	Location string `json:"location"`
}

type Request

type Request struct {
	// BaseURL is the Base URL of the datasource to query.
	BaseURL string

	// Token is the Bearer API token to authenticate a request.
	Token string

	// APIVersion the API version to use.
	APIVersion string

	// OrganizationID is the ID of the organization in Workday.
	OrganizationID string

	// PageSize is the maximum number of objects to return from the entity.
	PageSize int64

	// Ordered is a flag that indicates if the objects should be ordered.
	Ordered bool

	// Cursor identifies the first object of the page to return, as returned by
	// the last request for the entity.
	// nil in the request for the first page.
	Cursor *pagination.CompositeCursor[int64]

	// EntityConfig contains the attributes that will be used to build the wql query.
	EntityConfig *framework.EntityConfig

	// RequestTimeoutSeconds is the timeout duration for requests made to datasources.
	// This should be set to the number of seconds to wait before timing out.
	RequestTimeoutSeconds int
}

Request is a request to the datasource.

type Response

type Response struct {
	// StatusCode is an HTTP status code.
	StatusCode int

	// RetryAfterHeader is the Retry-After response HTTP header, if set.
	RetryAfterHeader string

	// Objects is the list of items returned by the datasource.
	// May be empty.
	Objects []map[string]any

	// NextCursor is the cursor that identifies the first object of the next page.
	// nil if this is the last page in this full sync.
	NextCursor *pagination.CompositeCursor[int64]
}

Response is a response returned by the datasource.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL