Skip to main content
Version: 1.x

Function: updateEntity()

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

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

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.

Intent

Update an existing OData entity by sending a PATCH request with partial data.

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 });