Skip to content

Documentation / @ember-data/json-api / request / serializeResources

Function: serializeResources()

Call Signature

ts
function serializeResources(cache, identifiers): object;

Defined in: warp-drive-packages/utilities/declarations/-private/json-api/serialize.d.ts:33

⚠️ This util often won't produce the necessary body for a {json:api} request

While this may come as a surprise, they are intended to serialize cache state for more generalized usage. {json:api} has a large variance in acceptable shapes, and only your app can ensure that the body is correctly formatted and contains all necessary data.

Serializes the current state of a resource or array of resources for use with POST or PUT requests.

Parameters

cache

Cache

identifiers

ResourceKey

Returns

object

An object with a data property containing the serialized resource patch

data

ts
data: ResourceObject;

Call Signature

ts
function serializeResources(cache, identifiers): object;

Defined in: warp-drive-packages/utilities/declarations/-private/json-api/serialize.d.ts:36

⚠️ This util often won't produce the necessary body for a {json:api} request

While this may come as a surprise, they are intended to serialize cache state for more generalized usage. {json:api} has a large variance in acceptable shapes, and only your app can ensure that the body is correctly formatted and contains all necessary data.

Serializes the current state of a resource or array of resources for use with POST or PUT requests.

Parameters

cache

Cache

identifiers

ResourceKey[]

Returns

object

An object with a data property containing the serialized resource patch

data

ts
data: ResourceObject[];

Released under the MIT License.