method

LocalAPI.Create

func (local *LocalAPI) Create( ctx context.Context, collection string, values store.Values, actor *store.Document, localeOptions ...LocaleOptions, ) (store.Document, error)

Create and validate a document through the shared operation engine.

Source core/local.go:218

@param ctx
Request context.
@param collection
Authored collection slug.
@param values
Submitted field values.
@param actor
Authenticated actor, or nil for an anonymous operation.
@param localeOptions
Optional locale selection.
@returns
The authorized created document, or an operation error.

Example

go
post, err := app.Local().Create(
  ctx,
  "posts",
  store.Values{"title": store.String("Hello, Ridu")},
  actor,
)

Related types

  • LocalAPI

    In-process content operations that share the REST authorization and lifecycle pipeline.

  • Values

    A map of field names to typed values.

  • Document

    A stored document with status and version metadata.

  • LocaleOptions

    Locale selection for one single-document Local API operation.