Function: createEntity()
createEntity<
TData>(page,serviceUrl,entitySet,data,options?):Promise<ODataHttpResult<TData>>
Defined in: src/modules/odata-http.ts:267
Creates a new entity via HTTP POST.
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.
data
unknown
Entity data to create.
options?
HTTP options including required CSRF token.
Returns
Promise<ODataHttpResult<TData>>
The created entity with HTTP status and optional ETag.
Intent
Create a new OData entity by sending a POST request to the service.
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 createEntity(page, '/sap/opu/odata/sap/SVC/', 'Products', {
Name: 'Widget',
Price: 42,
}, { csrfToken: token });