SR
Click to open github profile
Js Craftcms Api

Methods

Get an overview of all the methods of js-craftcms-api.


This API allows building urls for Craft CMS elements (addresses, assets, entries, and users) by providing a querybuilder.

Supported Element Types

Each element type has its own set of available methods. This ensures precise control and great type safty.

  • Addresses
  • Assets
  • Entries
  • Users
Note

Categories, Tags and Globals are not supported because they may be deprecated in the future.

Special Methods

These are methods available for all element types and are not native in Craft CMS.

Tip

When the type is defined as number[], you can always include operator strings such as not or and. You can find out more about types and methodes in the source code.

MethodDescriptionType
fieldsSelect specific fields to retrieve.string or string[]
buildBaseUrlBuild the url for one() or all()one or all

Address Methods

MethodDescriptionType
addressLine1Filter by first line of address.string
addressLine2Filter by second line of address.string
addressLine3Filter by third line of address.string
fullNameFilter by full name.string
idFilter by unique identifier.number or number[]
limitLimit the number of results returned.number
localityFilter by city or locality.string
offsetSet an offset for pagination.number
orderByDefine sorting order.string
organizationFilter by organization name.string

Asset Methods

MethodDescriptionType
filenameFilter by file name.string
idFilter by unique identifier.number or number[]
kindFilter by asset type (e.g., "image").string
limitLimit the number of results returned.number
offsetSet an offset for pagination.number
orderByDefine sorting order.string
siteFilter by site handle.string
siteIdFilter by site ID.number or number[]
volumeFilter by asset volume.string

Entry Methods

MethodDescriptionType
idFilter by unique identifier.number or number[]
levelFilter by the level.number or number[]
limitLimit the number of results returned.number
offsetSet an offset for pagination.number
orderByDefine sorting order.string
postDateFilter by post date.string
sectionFilter by section handle.string or string[]
sectionIdFilter by section id.number or number[]
siteFilter by site handle.string
siteIdFilter by site ID.number or number[]
slugFilter by entry slug.string
statusFilter by status.EntryStatusString or EntryStatusString[]
typeFilter by entryType.string or string[]
uriFilter by entry URI.string or string[]

User Methods

MethodDescriptionType
emailFilter by email address.string
fullNameFilter by full name.string
groupFilter by user group.string or string[]
groupIdFilter by user group ID.number or number[]
hasPhotoFilter users with profile photos.boolean
idFilter by unique identifier.number or number[]
limitLimit the number of results returned.number
offsetSet an offset for pagination.number
orderByDefine sorting order.string
statusFilter by status.UserStatusString or UserStatusString[]

Copyright © 2024 Samuel Reichör