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.
Method | Description | Type |
---|---|---|
fields | Select specific fields to retrieve. | string or string[] |
buildBaseUrl | Build the url for one() or all() | one or all |
Address Methods
Method | Description | Type |
---|---|---|
addressLine1 | Filter by first line of address. | string |
addressLine2 | Filter by second line of address. | string |
addressLine3 | Filter by third line of address. | string |
fullName | Filter by full name. | string |
id | Filter by unique identifier. | number or number[] |
limit | Limit the number of results returned. | number |
locality | Filter by city or locality. | string |
offset | Set an offset for pagination. | number |
orderBy | Define sorting order. | string |
organization | Filter by organization name. | string |
Asset Methods
Method | Description | Type |
---|---|---|
filename | Filter by file name. | string |
id | Filter by unique identifier. | number or number[] |
kind | Filter by asset type (e.g., "image"). | string |
limit | Limit the number of results returned. | number |
offset | Set an offset for pagination. | number |
orderBy | Define sorting order. | string |
site | Filter by site handle. | string |
siteId | Filter by site ID. | number or number[] |
volume | Filter by asset volume. | string |
Entry Methods
Method | Description | Type |
---|---|---|
id | Filter by unique identifier. | number or number[] |
level | Filter by the level. | number or number[] |
limit | Limit the number of results returned. | number |
offset | Set an offset for pagination. | number |
orderBy | Define sorting order. | string |
postDate | Filter by post date. | string |
section | Filter by section handle. | string or string[] |
sectionId | Filter by section id. | number or number[] |
site | Filter by site handle. | string |
siteId | Filter by site ID. | number or number[] |
slug | Filter by entry slug. | string |
status | Filter by status. | EntryStatusString or EntryStatusString[] |
type | Filter by entryType. | string or string[] |
uri | Filter by entry URI. | string or string[] |
User Methods
Method | Description | Type |
---|---|---|
email | Filter by email address. | string |
fullName | Filter by full name. | string |
group | Filter by user group. | string or string[] |
groupId | Filter by user group ID. | number or number[] |
hasPhoto | Filter users with profile photos. | boolean |
id | Filter by unique identifier. | number or number[] |
limit | Limit the number of results returned. | number |
offset | Set an offset for pagination. | number |
orderBy | Define sorting order. | string |
status | Filter by status. | UserStatusString or UserStatusString[] |