ContentService Class
Creates an instance of Content Service object. Use ContentService to retrieve information and execute operations related to Content.
Note on the callbacks usage
The callback argument of the service methods always take 2 arguments:
Example:
contentService.loadRoot(function (error, response) {
if (error) {
console.log('An error occurred', error);
} else {
console.log('Success!', response);
}
});
Constructor
ContentService
-
connectionManager -
discoveryService -
rootPath
Parameters:
-
connectionManagerConnectionManagerconnection manager that will be used to send requests to REST service
-
discoveryServiceDiscoveryServiceis handling REST paths auto-discovery
-
rootPathStringpath to Root resource
Example:
var contentService = jsCAPI.getContentService();
Item Index
Methods
- addRelation
- copyContent
- copySubtree
- createContent
- createContentDraft
- createLocation
- createObjectState
- createObjectStateGroup
- createSection
- createUrlAlias
- createUrlWildcard
- createView
- deleteContent
- deleteLocation
- deleteObjectState
- deleteObjectStateGroup
- deleteRelation
- deleteSection
- deleteTrashItem
- deleteUrlAlias
- deleteUrlWildcard
- deleteVersion
- emptyThrash deprecated
- emptyTrash
- getContentState
- listLocationAliases
- loadContent
- loadContentByRemoteId
- loadContentInfo
- loadContentInfoAndCurrentVersion
- loadCurrentRelations
- loadCurrentVersion
- loadImageVariation
- loadLocation
- loadLocationByRemoteId
- loadLocationChildren
- loadLocations
- loadObjectState
- loadObjectStateGroup
- loadObjectStateGroups
- loadRelation
- loadRelations
- loadRoot
- loadSection
- loadSections
- loadTrashItem
- loadTrashItems
- loadUrlAlias
- loadUrlAliases
- loadUrlWildcard
- loadUrlWildcards
- loadUserDrafts
- loadVersions
- moveSubtree
- newContentCreateStruct
- newContentMetadataUpdateStruct
- newContentUpdateStruct
- newLocationCreateStruct
- newLocationUpdateStruct
- newObjectStateCreateStruct
- newObjectStateGroupCreateStruct
- newObjectStateGroupUpdateStruct
- newObjectStateUpdateStruct
- newRelationCreateStruct
- newSectionInputStruct
- newUrlAliasCreateStruct
- newUrlWildcardCreateStruct
- newViewCreateStruct
- publishVersion
- recover
- setContentState
- swapLocation
- updateContent
- updateContentMetadata
- updateLocation
- updateObjectState
- updateObjectStateGroup
- updateSection
Methods
addRelation
-
versionedContentId -
relationCreateStruct -
callback
Creates a new relation of type COMMON for the given draft.
Parameters:
-
versionedContentIdStringtarget version identifier (e.g. "/api/ezp/v2/content/objects/102/versions/5")
-
relationCreateStructRelationCreateStructobject describing new relation to be created
-
callbackFunctioncallback executed after performing the request (see Note on the callbacks usage for more info)
Example:
var relationCreateStruct = contentService.newRelationCreateStruct("/api/ezp/v2/content/objects/132");
contentService.addRelation(
"/api/ezp/v2/content/objects/102/versions/5",
relationCreateStruct,
callback
);
copyContent
-
contentId -
destinationId -
callback
Copy content to determined location
Parameters:
-
contentIdStringtarget content identifier (e.g. "/api/ezp/v2/content/objects/108")
-
destinationIdStringA location resource to which the content object should be copied (e.g. "/api/ezp/v2/content/locations/1/2/119")
-
callbackFunctioncallback executed after performing the request (see Note on the callbacks usage for more info)
copySubtree
-
subtree -
targetLocation -
callback
Copies the subtree starting from "subtree" as a new subtree of "targetLocation"
Parameters:
-
subtreeStringsource subtree location
-
targetLocationStringlocation where source subtree should be copied
-
callbackFunctioncallback executed after performing the request (see Note on the callbacks usage for more info)
createContent
-
contentCreateStruct -
[requestEventHandlers] -
callback
Creates a new content draft assigned to the authenticated user.
Parameters:
-
contentCreateStructContentCreateStructobject describing content to be created
-
[requestEventHandlers]Object optionala set of callbacks to apply on a specific XHR event like onload, onerror, onprogress, etc.
-
callbackFunctioncallback executed after performing the request (see Note on the callbacks usage for more info)
Example:
var contentService = jsCAPI.getContentService();
contentService.createContent(
{
body: '',
headers: {}
},
{
upload: {
onloadstart: someUploadCallback,
onload: someUploadCallback,
onloadend: someUploadCallback,
onprogress: someUploadCallback,
onabort: someUploadCallback,
onerror: someUploadCallback,
ontimeout: someUploadCallback,
},
onloadstart: someCallback,
onload: someCallback,
onloadend: someCallback,
onprogress: someCallback,
onabort: someCallback,
onerror: someCallback,
ontimeout: someCallback,
},
callback
);
createContentDraft
-
contentId -
[versionId] -
callback
Creates a draft from a published or archived version.
Parameters:
-
contentIdStringtarget content identifier (e.g. "/api/ezp/v2/content/objects/108")
-
[versionId]Number optionalnumerical id of the base version for the new draft. If not provided the current version of the content will be used.
-
callbackFunctioncallback executed after performing the request (see Note on the callbacks usage for more info)
Example:
// Create draft from current version
contentService.createContentDraft(
"/api/ezp/v2/content/objects/107",
null,
callback
);
// Create draft from version #2
contentService.createContentDraft(
"/api/ezp/v2/content/objects/107",
2,
callback
);
createLocation
-
contentId -
locationCreateStruct -
callback
Creates a new location for target content object
Parameters:
-
contentIdStringtarget content identifier (e.g. "/api/ezp/v2/content/objects/108")
-
locationCreateStructLocationCreateStructobject describing new location to be created
-
callbackFunctioncallback executed after performing the request (see Note on the callbacks usage for more info)
createObjectState
-
objectStateGroupId -
objectStateCreateStruct -
callback
Creates a new ObjectState in target group
Parameters:
-
objectStateGroupIdStringtarget group, where new object state should be created (e.g. "/api/ezp/v2/content/objectstategroups/2")
-
objectStateCreateStructObjectStateCreateStructobject describing new ObjectState to be created
-
callbackFunctioncallback executed after performing the request (see Note on the callbacks usage for more info)
createObjectStateGroup
-
objectStateGroups -
objectStateGroupCreateStruct -
callback
Create a new ObjectState group
Parameters:
-
objectStateGroupsStringpath to root objectStateGroups (will be replaced by auto-discovered soon)
-
objectStateGroupCreateStructObjectStateGroupCreateStructobject describing new ObjectState group to be created
-
callbackFunctioncallback executed after performing the request (see Note on the callbacks usage for more info)
createSection
-
sectionInputStruct -
callback
Create a new section
Parameters:
-
sectionInputStructSectionInputStructobject describing section to be created
-
callbackFunctioncallback executed after performing the request (see Note on the callbacks usage for more info)
createUrlAlias
-
urlAliases -
urlAliasCreateStruct -
callback
Creates a new UrlAlias
Parameters:
-
urlAliasesStringlink to root UrlAliases resource (should be auto-discovered)
-
urlAliasCreateStructUrlAliasCreateStructobject describing new UrlAlias to be created
-
callbackFunctioncallback executed after performing the request (see Note on the callbacks usage for more info)
createUrlWildcard
-
urlWildcards -
urlWildcardCreateStruct -
callback
Creates a new UrlWildcard
Parameters:
-
urlWildcardsStringlink to root UrlWildcards resource (should be auto-discovered)
-
urlWildcardCreateStructUrlWildcardCreateStructobject describing new UrlWildcard to be created
-
callbackFunctioncallback executed after performing the request (see Note on the callbacks usage for more info)
createView
-
viewCreateStruct -
callback
Creates a new view. Views are used to perform content queries by certain criteria.
Parameters:
-
viewCreateStructViewCreateStructobject describing new view to be created
-
callbackFunctioncallback executed after performing the request (see Note on the callbacks usage for more info)
Example:
var viewCreateStruct = contentService.newViewCreateStruct('some-test-id', 'LocationQuery');
viewCreateStruct.body.ViewInput.LocationQuery.Query = {
FullTextCriterion : "title"
};
contentService.createView(
viewCreateStruct,
callback
);
deleteContent
-
contentId -
callback
Delete target content
Parameters:
-
contentIdStringtarget content identifier (e.g. "/api/ezp/v2/content/objects/108")
-
callbackFunctioncallback executed after performing the request (see Note on the callbacks usage for more info)
Example:
contentService.deleteContent(
"/api/ezp/v2/content/objects/116",
callback
);
deleteLocation
-
locationId -
callback
Deletes the location and all it's subtrees Every content object is deleted which does not have any other location. Otherwise the deleted location is removed from the content object. The children are recursively deleted.
Parameters:
-
locationIdStringtarget location identifier (e.g. "/api/ezp/v2/content/locations/1/2/102")
-
callbackFunctioncallback executed after performing the request (see Note on the callbacks usage for more info)
deleteObjectState
-
objectStateId -
callback
Delete target ObjectState
Parameters:
-
objectStateIdStringtarget object state identifier (e.g. "/api/ezp/v2/content/objectstategroups/7/objectstates/5")
-
callbackFunctioncallback executed after performing the request (see Note on the callbacks usage for more info)
deleteObjectStateGroup
-
objectStateGroupId -
callback
Delete target ObjectState group
Parameters:
-
objectStateGroupIdStringtarget object state group identifier (e.g. "/api/ezp/v2/content/objectstategroups/2")
-
callbackFunctioncallback executed after performing the request (see Note on the callbacks usage for more info)
deleteRelation
-
relationId -
callback
Delete target relation
Parameters:
-
relationIdStringtarget relation identifier (e.g. "/api/ezp/v2/content/objects/102/versions/5/relations/1")
-
callbackFunctioncallback executed after performing the request (see Note on the callbacks usage for more info)
deleteSection
-
sectionId -
callback
Delete target section
Parameters:
-
sectionIdStringtarget section identifier (e.g. "/api/ezp/v2/content/sections/2")
-
callbackFunctioncallback executed after performing the request (see Note on the callbacks usage for more info)
deleteTrashItem
-
trashItemId -
callback
Delete target trashItem
Parameters:
-
trashItemIdStringtarget trash item identifier (e.g. "/api/ezp/v2/content/trash/1")
-
callbackFunctioncallback executed after performing the request (see Note on the callbacks usage for more info)
deleteUrlAlias
-
urlAliasId -
callback
Delete target URL Alias
Parameters:
-
urlAliasIdStringtarget url alias identifier (e.g. "/api/ezp/v2/content/urlaliases/0-a903c03b86eb2987889afa5fe17004eb")
-
callbackFunctioncallback executed after performing the request (see Note on the callbacks usage for more info)
deleteUrlWildcard
-
urlWildcardId -
callback
Deletes target UrlWildcard
Parameters:
-
urlWildcardIdStringtarget url wildcard identifier (e.g. "/api/ezp/v2/content/urlwildcards/1")
-
callbackFunctioncallback executed after performing the request (see Note on the callbacks usage for more info)
deleteVersion
-
versionedContentId -
callback
Deletes target version of the content.
Parameters:
-
versionedContentIdStringtarget version identifier (e.g. "/api/ezp/v2/content/objects/108/versions/2")
-
callbackFunctioncallback executed after performing the request (see Note on the callbacks usage for more info)
emptyThrash
-
callback
Empty the trash can
Parameters:
-
callbackFunctioncallback executed after performing the request (see Note on the callbacks usage for more info)
emptyTrash
-
callback
Empty the trash can
Parameters:
-
callbackFunctioncallback executed after performing the request (see Note on the callbacks usage for more info)
getContentState
-
contentStatesId -
callback
Get ObjectStates of target content
Parameters:
-
contentStatesIdStringlink to target content's object states (should be auto-discovered from contentId)
-
callbackFunctioncallback executed after performing the request (see Note on the callbacks usage for more info)
listLocationAliases
-
locationUrlAliases -
[custom=true] -
callback
Loads all the UrlAliases for a location
Parameters:
-
locationUrlAliasesStringlink to target location's UrlAliases (should be auto-discovered from locationId)
-
[custom=true]Boolean optionalthis flag indicates weather autogenerated (false) or manual url aliases (true) should be returned
-
callbackFunctioncallback executed after performing the request (see Note on the callbacks usage for more info)
loadContent
-
versionedContentId -
[languages=''] -
[fields=''] -
[responseGroups=''] -
callback
Loads a specific version of target content. This method returns fields and relations
Parameters:
-
versionedContentIdStringtarget version identifier (e.g. "/api/ezp/v2/content/objects/108/versions/2")
-
[languages='']String optional(comma separated list) restricts the output of translatable fields to the given languages.
-
[fields='']String optionalcomma separated list of fields which should be returned in the response (see Content).
-
[responseGroups='']String optionalalternative: comma separated lists of predefined field groups (see REST API Spec v1).
-
callbackFunctioncallback executed after performing the request (see Note on the callbacks usage for more info)
Example:
contentService.loadContent(
'/api/ezp/v2/content/objects/180/versions/1',
'eng-US',
'',
'',
callback
);
loadContentByRemoteId
-
remoteId -
callback
Load single content by remoteId
Parameters:
-
remoteIdStringremote id of target content object (e.g. "30847bec12a8a398777493a4bdb10398")
-
callbackFunctioncallback executed after performing the request (see Note on the callbacks usage for more info)
loadContentInfo
-
contentId -
callback
Load single content info
Parameters:
-
contentIdStringtarget content identifier (e.g. "/api/ezp/v2/content/objects/108")
-
callbackFunctioncallback executed after performing the request (see Note on the callbacks usage for more info)
loadContentInfoAndCurrentVersion
-
contentId -
[languageCodes=false] -
callback
Load single content info with embedded current version
Parameters:
-
contentIdStringtarget content identifier (e.g. "/api/ezp/v2/content/objects/108")
-
[languageCodes=false]String optionalcomma separated list of language codes (ie "fre-FR,eng-GB")
-
callbackFunctioncallback executed after performing the request (see Note on the callbacks usage for more info)
loadCurrentRelations
-
contentId -
[limit=-1] -
[offset=0] -
callback
Loads the relations of the target content's current version
Parameters:
-
contentIdStringtarget content identifier (e.g. "/api/ezp/v2/content/objects/102")
-
[limit=-1]Number optionalthe number of results returned
-
[offset=0]Number optionalthe offset of the result set
-
callbackFunctioncallback executed after performing the request (see Note on the callbacks usage for more info)
Example:
//See loadLocationChildren for example of "offset" and "limit" arguments usage
loadCurrentVersion
-
contentId -
callback
Load current version for target content
Parameters:
-
contentIdStringtarget content identifier (e.g. "/api/ezp/v2/content/objects/108")
-
callbackFunctioncallback executed after performing the request (see Note on the callbacks usage for more info)
loadImageVariation
-
variation -
callback
Loads an image variation
Parameters:
-
variationStringThe variation REST id
-
callbackFunctionCallback executed after performing the request (see Note on the callbacks usage for more info)
loadLocation
-
locationId -
callback
Loads target location
Parameters:
-
locationIdStringtarget location identifier (e.g. "/api/ezp/v2/content/locations/1/2/102")
-
callbackFunctioncallback executed after performing the request (see Note on the callbacks usage for more info)
loadLocationByRemoteId
-
remoteId -
callback
Loads target location by remote Id
Parameters:
-
remoteIdStringremote id of target location (e.g. "0bae96bd419e141ff3200ccbf2822e4f")
-
callbackFunctioncallback executed after performing the request (see Note on the callbacks usage for more info)
loadLocationChildren
-
locationId -
[limit=-1] -
[offset=0] -
callback
Loads children for the target location
Parameters:
-
locationIdStringtarget location identifier (e.g. "/api/ezp/v2/content/locations/1/2/102")
-
[limit=-1]Number optionalthe number of results returned
-
[offset=0]Number optionalthe offset of the result set
-
callbackFunctioncallback executed after performing the request (see Note on the callbacks usage for more info)
Example:
contentService.loadLocationChildren(
"/api/ezp/v2/content/locations/1/2/102",
5,
5,
callback
);
loadLocations
-
contentId -
callback
Loads all locations for target content object
Parameters:
-
contentIdStringtarget content identifier (e.g. "/api/ezp/v2/content/objects/108")
-
callbackFunctioncallback executed after performing the request (see Note on the callbacks usage for more info)
loadObjectState
-
objectStateId -
callback
Load target ObjectState
Parameters:
-
objectStateIdStringtarget object state identifier (e.g. "/api/ezp/v2/content/objectstategroups/7/objectstates/5")
-
callbackFunctioncallback executed after performing the request (see Note on the callbacks usage for more info)
loadObjectStateGroup
-
objectStateGroupId -
callback
Loads target ObjectState group
Parameters:
-
objectStateGroupIdStringtarget object state group identifier (e.g. "/api/ezp/v2/content/objectstategroups/2")
-
callbackFunctioncallback executed after performing the request (see Note on the callbacks usage for more info)
loadObjectStateGroups
-
objectStateGroups -
callback
Loads all the ObjectState groups
Parameters:
-
objectStateGroupsStringpath to root objectStateGroups (will be replaced by auto-discovered soon)
-
callbackFunctioncallback executed after performing the request (see Note on the callbacks usage for more info)
loadRelation
-
relationId -
callback
Loads target relation
Parameters:
-
relationIdStringtarget relation identifier (e.g. "/api/ezp/v2/content/objects/102/versions/5/relations/1")
-
callbackFunctioncallback executed after performing the request (see Note on the callbacks usage for more info)
loadRelations
-
versionedContentId -
[limit=-1] -
[offset=0] -
callback
Loads the relations of the target version.
Parameters:
-
versionedContentIdStringtarget version identifier (e.g. "/api/ezp/v2/content/objects/108/versions/2")
-
[limit=-1]Number optionalthe number of results returned
-
[offset=0]Number optionalthe offset of the result set
-
callbackFunctioncallback executed after performing the request (see Note on the callbacks usage for more info)
Example:
//See loadLocationChildren for example of "offset" and "limit" arguments usage
loadRoot
-
callback
List the root resources of the eZ Publish installation. Root resources contain many paths and references to other parts of the REST interface. This call is used by DiscoveryService automatically, whenever needed.
Parameters:
-
callbackFunctioncallback executed after performing the request (see Note on the callbacks usage for more info)
loadSection
-
sectionId -
callback
Load single section
Parameters:
-
sectionIdStringtarget section identifier (e.g. "/api/ezp/v2/content/sections/2")
-
callbackFunctioncallback executed after performing the request (see Note on the callbacks usage for more info)
loadSections
-
callback
List all available sections of eZ Publish instance
Parameters:
-
callbackFunctioncallback executed after performing the request (see Note on the callbacks usage for more info)
loadTrashItem
-
trashItemId -
callback
Loads target trash can item
Parameters:
-
trashItemIdStringtarget trash item identifier (e.g. "/api/ezp/v2/content/trash/1")
-
callbackFunctioncallback executed after performing the request (see Note on the callbacks usage for more info)
loadTrashItems
-
[limit=-1] -
[offset=0] -
callback
Loads all the trash can items
Parameters:
-
[limit=-1]Number optionalthe number of results returned
-
[offset=0]Number optionalthe offset of the result set
-
callbackFunctioncallback executed after performing the request (see Note on the callbacks usage for more info)
Example:
//See loadLocationChildren for example of "offset" and "limit" arguments usage
loadUrlAlias
-
urlAliasId -
callback
Load target URL Alias
Parameters:
-
urlAliasIdStringtarget url alias identifier (e.g. "/api/ezp/v2/content/urlaliases/0-a903c03b86eb2987889afa5fe17004eb")
-
callbackFunctioncallback executed after performing the request (see Note on the callbacks usage for more info)
loadUrlAliases
-
urlAliases -
callback
Loads all the global UrlAliases
Parameters:
-
urlAliasesStringlink to root UrlAliases resource (should be auto-discovered)
-
callbackFunctioncallback executed after performing the request (see Note on the callbacks usage for more info)
loadUrlWildcard
-
urlWildcardId -
callback
Loads target UrlWildcard
Parameters:
-
urlWildcardIdStringtarget url wildcard identifier (e.g. "/api/ezp/v2/content/urlwildcards/1")
-
callbackFunctioncallback executed after performing the request (see Note on the callbacks usage for more info)
loadUrlWildcards
-
urlWildcards -
callback
Loads all UrlWildcards
Parameters:
-
urlWildcardsStringlink to root UrlWildcards resource (should be auto-discovered)
-
callbackFunctioncallback executed after performing the request (see Note on the callbacks usage for more info)
loadUserDrafts
-
userId -
callback
Loads user drafts
Parameters:
-
userIdStringtarget user identifier (e.g. "/api/ezp/v2/user/users/14")
-
callbackFunctioncallback executed after performing the request (see Note on the callbacks usage for more info)
loadVersions
-
contentId -
callback
Loads all versions for the target content
Parameters:
-
contentIdStringtarget content identifier (e.g. "/api/ezp/v2/content/objects/108")
-
callbackFunctioncallback executed after performing the request (see Note on the callbacks usage for more info)
moveSubtree
-
subtree -
targetLocation -
callback
Moves the subtree to a new subtree of "targetLocation" The targetLocation can also be /content/trash, in that case the location is put into the trash.
Parameters:
-
subtreeStringsource subtree location
-
targetLocationStringlocation where source subtree should be moved
-
callbackFunctioncallback executed after performing the request (see Note on the callbacks usage for more info)
newContentCreateStruct
-
contentTypeId -
locationCreateStruct -
language
Returns create structure for Content object
Parameters:
-
contentTypeIdStringContent Type for new Content object (e.g.: /api/v2/ezp/content/type/1)
-
locationCreateStructLocationCreateStructcreate structure for a Location object, where the new Content object will be situated
-
languageStringThe language code (eng-GB, fre-FR, ...)
Returns:
newContentMetadataUpdateStruct
()
Returns update structure for Content object metadata
Returns:
ContentMetadataUpdateStruct
newContentUpdateStruct
-
language
Returns update structure for Content object
Parameters:
-
languageStringThe language code (eng-GB, fre-FR, ...)
Returns:
newLocationCreateStruct
-
parentLocationId
Returns create structure for Location object
Parameters:
-
parentLocationIdStringReference to the parent location of the new Location. (e.g. "/api/ezp/v2/content/locations/1/2/118")
Returns:
newLocationUpdateStruct
()
LocationUpdateStruct
Returns update structure for Location object
Returns:
newObjectStateCreateStruct
-
identifier -
languageCode -
priority -
names -
descriptions
Returns create structure for ObjectState
Parameters:
-
identifierStringunique ObjectState identifier (e.g. "some-new-state")
-
languageCodeStringThe language code (eng-GB, fre-FR, ...)
-
priorityNumber -
namesArrayMulti language value (see example)
-
descriptionsArrayMulti language value (see example)
Returns:
Example:
var objectStateCreateStruct = contentService.newObjectStateCreateStruct(
"some-id", "eng-US", 0, [{
"_languageCode":"eng-US",
"#text":"Some Name"
}], [{
"_languageCode":"eng-US",
"#text":"Some Description"
}]
);
newObjectStateGroupCreateStruct
-
identifier -
languageCode -
names
Returns create structure for ObjectStateGroup
Parameters:
-
identifierStringunique ObjectStateGroup identifier (e.g. "some-new-group")
-
languageCodeStringThe language code (eng-GB, fre-FR, ...)
-
namesArrayMulti language value (see example)
Returns:
Example:
var objectStateGroupCreateStruct = contentService.newObjectStateGroupCreateStruct(
"some-id", "eng-US", [{
"_languageCode":"eng-US",
"#text":"Some Name"
}]
);
newObjectStateGroupUpdateStruct
()
Returns update structure for ObjectStateGroup
Returns:
ObjectStateGroupUpdateStruct
newObjectStateUpdateStruct
()
ObjectStateUpdateStruct
Returns update structure for ObjectState
Returns:
newRelationCreateStruct
-
destination
Returns create structure for Relation
Parameters:
-
destinationStringreference to the resource we want to make related
Returns:
newSectionInputStruct
-
identifier -
name
Returns input structure for Section object. Input structure is needed while creating and updating the object.
Parameters:
-
identifierStringunique section identifier (e.g. "media")
-
nameStringsection name (e.g. "Media")
Returns:
newUrlAliasCreateStruct
-
languageCode -
resource -
path
Returns create structure for UrlAlias
Parameters:
-
languageCodeStringThe language code (eng-GB, fre-FR, ...)
-
resourceStringeZ Publish resource you want to create alias for
-
pathStringthe new alias itself
Returns:
Example:
var urlAliasCreateStruct = contentService.newUrlAliasCreateStruct(
"eng-US",
"content/search",
"findme-alias"
);
newUrlWildcardCreateStruct
-
sourceUrl -
destinationUrl -
forward
Returns create structure for UrlWildcard
Parameters:
-
sourceUrlStringnew url wildcard
-
destinationUrlStringexisting resource where wildcard should point
-
forwardBooleanweather or not the wildcard should redirect to the resource
Example:
var urlWildcardCreateStruct = contentService.newUrlWildcardCreateStruct(
"some-new-wildcard",
"/api/ezp/v2/content/locations/1/2/113",
"false"
);
newViewCreateStruct
-
identifier -
[type="ContentQuery"]
Returns create structure for View object
Parameters:
-
identifierStringunique view identifier (e.g. "my-new-view")
-
[type="ContentQuery"]String optionalthe view type to create
Returns:
publishVersion
-
versionedContentId -
callback
Publishes target version of the content.
Parameters:
-
versionedContentIdStringtarget version identifier (e.g. "/api/ezp/v2/content/objects/108/versions/2")
-
callbackFunctioncallback executed after performing the request (see Note on the callbacks usage for more info)
recover
-
trashItemId -
[destination] -
callback
Restores target trashItem
Parameters:
-
trashItemIdStringtarget trash item identifier (e.g. "/api/ezp/v2/content/trash/1")
-
[destination]String optionalif given the trash item is restored under this location otherwise under its original parent location
-
callbackFunctioncallback executed after performing the request (see Note on the callbacks usage for more info)
setContentState
-
contentStatesId -
objectStates -
callback
Set ObjectStates of a content
Parameters:
-
contentStatesIdStringlink to target content's object states (should be auto-discovered from contentId)
-
objectStatesArray -
callbackFunctioncallback executed after performing the request (see Note on the callbacks usage for more info)
Example:
contentService.loadObjectState( "/api/ezp/v2/content/objectstategroups/4/objectstates/3", function (error, objectStateResponse) { // possible error should be handled...
var objectStates = {};
// Extra odd structure, but it works!
objectStates.ObjectState = {};
objectStates.ObjectState.ObjectState = {};
objectStates.ObjectState.ObjectState = JSON.parse(objectStateResponse.body);
contentService.setContentState(
"/api/ezp/v2/content/objects/17/objectstates",
objectStates,
callback
);
}
);
swapLocation
-
subtree -
targetLocation -
callback
Swaps the location of the "subtree" with "targetLocation"
Parameters:
-
subtreeStringsource subtree location
-
targetLocationStringlocation with which subtree location should be swapped
-
callbackFunctioncallback executed after performing the request (see Note on the callbacks usage for more info)
updateContent
-
versionedContentId -
contentUpdateStruct -
callback
Updates the fields of a target draft
Parameters:
-
versionedContentIdStringtarget version identifier (e.g. "/api/ezp/v2/content/objects/108/versions/2")
-
contentUpdateStructContentUpdateStructobject describing update to the draft
-
callbackFunctioncallback executed after performing the request (see Note on the callbacks usage for more info)
updateContentMetadata
-
contentId -
contentMetadataUpdateStruct -
callback
Update target content metadata.
Parameters:
-
contentIdStringtarget content identifier (e.g. "/api/ezp/v2/content/objects/108")
-
contentMetadataUpdateStructContentMetadataUpdateStructobject describing update of the content metadata
-
callbackFunctioncallback executed after performing the request (see Note on the callbacks usage for more info)
Example:
var updateStruct = contentService.newContentMetadataUpdateStruct("eng-US");
updateStruct.body.ContentUpdate.Section = "/api/ezp/v2/content/sections/2";
updateStruct.body.ContentUpdate.remoteId = "new-remote-id";
contentService.updateContentMetadata(
"/api/ezp/v2/content/objects/180",
updateStruct,
callback
);
updateLocation
-
locationId -
locationUpdateStruct -
callback
Updates target location
Parameters:
-
locationIdStringtarget location identifier (e.g. "/api/ezp/v2/content/locations/1/2/102")
-
locationUpdateStructLocationUpdateStructobject describing changes to target location
-
callbackFunctioncallback executed after performing the request (see Note on the callbacks usage for more info)
updateObjectState
-
objectStateId -
objectStateUpdateStruct -
callback
Update target ObjectState
Parameters:
-
objectStateIdStringtarget object state identifier (e.g. "/api/ezp/v2/content/objectstategroups/7/objectstates/5")
-
objectStateUpdateStructObjectStateUpdateStructobject describing changes to target ObjectState
-
callbackFunctioncallback executed after performing the request (see Note on the callbacks usage for more info)
updateObjectStateGroup
-
objectStateGroupId -
objectStateGroupUpdateStruct -
callback
Update target ObjectState group
Parameters:
-
objectStateGroupIdStringtarget object state group identifier (e.g. "/api/ezp/v2/content/objectstategroups/2")
-
objectStateGroupUpdateStructObjectStateGroupUpdateStructobject describing changes to target ObjectState group
-
callbackFunctioncallback executed after performing the request (see Note on the callbacks usage for more info)
updateSection
-
sectionId -
sectionInputStruct -
callback
Update target section
Parameters:
-
sectionIdStringtarget section identifier (e.g. "/api/ezp/v2/content/sections/2")
-
sectionInputStructSectionInputStructobject describing updates to the section
-
callbackFunctioncallback executed after performing the request (see Note on the callbacks usage for more info)
