Skip to main content

Function: updateEntity()

updateEntity<TData>(page, serviceUrl, entitySet, key, data, options?): Promise<ODataHttpResult<TData>>

Defined in: src/modules/odata-http.ts:296

Updates an existing entity via HTTP PATCH.

Type Parameters​

TData​

TData = unknown

Parameters​

page​

ODataHttpPage

Playwright Page with request API.

serviceUrl​

string

OData service root URL.

entitySet​

string

Name of the entity set.

key​

string

Entity key including parentheses, e.g. "('123')".

data​

unknown

Partial entity data to update.

options?​

ODataHttpOptions

HTTP options including required CSRF token.

Returns​

Promise<ODataHttpResult<TData>>

The updated entity with HTTP status and optional ETag.

Throws​

ODataError with ERR_ODATA_CSRF if CSRF token is missing.

Throws​

ODataError with ERR_ODATA_REQUEST_FAILED on HTTP error.

Example​

const result = await updateEntity(page, '/sap/opu/odata/sap/SVC/', 'Products', "('123')", {
Price: 50,
}, { csrfToken: token });