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.
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 |
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 |
status | Filter by status. | string |
Asset Methods
Method | Description | Type |
---|---|---|
filename | Filter by file name. | string |
id | Filter by unique identifier. | 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 |
status | Filter by status. | string |
volume | Filter by asset volume. | string |
Entry Methods
Method | Description | Type |
---|---|---|
id | Filter by unique identifier. | 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 |
site | Filter by site handle. | string |
siteId | Filter by site ID. | number |
slug | Filter by entry slug. | string |
status | Filter by status. | 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 |
groupId | Filter by user group ID. | number |
hasPhoto | Filter users with profile photos. | boolean |
id | Filter by unique identifier. | 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. | string |