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:
-
connectionManager
ConnectionManagerconnection manager that will be used to send requests to REST service
-
discoveryService
DiscoveryServiceis handling REST paths auto-discovery
-
rootPath
Stringpath 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:
-
versionedContentId
Stringtarget version identifier (e.g. "/api/ezp/v2/content/objects/102/versions/5")
-
relationCreateStruct
RelationCreateStructobject describing new relation to be created
-
callback
Functioncallback 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:
-
contentId
Stringtarget content identifier (e.g. "/api/ezp/v2/content/objects/108")
-
destinationId
StringA location resource to which the content object should be copied (e.g. "/api/ezp/v2/content/locations/1/2/119")
-
callback
Functioncallback 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:
-
subtree
Stringsource subtree location
-
targetLocation
Stringlocation where source subtree should be copied
-
callback
Functioncallback 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:
-
contentCreateStruct
ContentCreateStructobject describing content to be created
-
[requestEventHandlers]
Object optionala set of callbacks to apply on a specific XHR event like onload, onerror, onprogress, etc.
-
callback
Functioncallback 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:
-
contentId
Stringtarget 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.
-
callback
Functioncallback 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:
-
contentId
Stringtarget content identifier (e.g. "/api/ezp/v2/content/objects/108")
-
locationCreateStruct
LocationCreateStructobject describing new location to be created
-
callback
Functioncallback 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:
-
objectStateGroupId
Stringtarget group, where new object state should be created (e.g. "/api/ezp/v2/content/objectstategroups/2")
-
objectStateCreateStruct
ObjectStateCreateStructobject describing new ObjectState to be created
-
callback
Functioncallback executed after performing the request (see Note on the callbacks usage for more info)
createObjectStateGroup
-
objectStateGroups
-
objectStateGroupCreateStruct
-
callback
Create a new ObjectState group
Parameters:
-
objectStateGroups
Stringpath to root objectStateGroups (will be replaced by auto-discovered soon)
-
objectStateGroupCreateStruct
ObjectStateGroupCreateStructobject describing new ObjectState group to be created
-
callback
Functioncallback executed after performing the request (see Note on the callbacks usage for more info)
createSection
-
sectionInputStruct
-
callback
Create a new section
Parameters:
-
sectionInputStruct
SectionInputStructobject describing section to be created
-
callback
Functioncallback executed after performing the request (see Note on the callbacks usage for more info)
createUrlAlias
-
urlAliases
-
urlAliasCreateStruct
-
callback
Creates a new UrlAlias
Parameters:
-
urlAliases
Stringlink to root UrlAliases resource (should be auto-discovered)
-
urlAliasCreateStruct
UrlAliasCreateStructobject describing new UrlAlias to be created
-
callback
Functioncallback executed after performing the request (see Note on the callbacks usage for more info)
createUrlWildcard
-
urlWildcards
-
urlWildcardCreateStruct
-
callback
Creates a new UrlWildcard
Parameters:
-
urlWildcards
Stringlink to root UrlWildcards resource (should be auto-discovered)
-
urlWildcardCreateStruct
UrlWildcardCreateStructobject describing new UrlWildcard to be created
-
callback
Functioncallback 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:
-
viewCreateStruct
ViewCreateStructobject describing new view to be created
-
callback
Functioncallback 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:
-
contentId
Stringtarget content identifier (e.g. "/api/ezp/v2/content/objects/108")
-
callback
Functioncallback 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:
-
locationId
Stringtarget location identifier (e.g. "/api/ezp/v2/content/locations/1/2/102")
-
callback
Functioncallback executed after performing the request (see Note on the callbacks usage for more info)
deleteObjectState
-
objectStateId
-
callback
Delete target ObjectState
Parameters:
-
objectStateId
Stringtarget object state identifier (e.g. "/api/ezp/v2/content/objectstategroups/7/objectstates/5")
-
callback
Functioncallback executed after performing the request (see Note on the callbacks usage for more info)
deleteObjectStateGroup
-
objectStateGroupId
-
callback
Delete target ObjectState group
Parameters:
-
objectStateGroupId
Stringtarget object state group identifier (e.g. "/api/ezp/v2/content/objectstategroups/2")
-
callback
Functioncallback executed after performing the request (see Note on the callbacks usage for more info)
deleteRelation
-
relationId
-
callback
Delete target relation
Parameters:
-
relationId
Stringtarget relation identifier (e.g. "/api/ezp/v2/content/objects/102/versions/5/relations/1")
-
callback
Functioncallback executed after performing the request (see Note on the callbacks usage for more info)
deleteSection
-
sectionId
-
callback
Delete target section
Parameters:
-
sectionId
Stringtarget section identifier (e.g. "/api/ezp/v2/content/sections/2")
-
callback
Functioncallback executed after performing the request (see Note on the callbacks usage for more info)
deleteTrashItem
-
trashItemId
-
callback
Delete target trashItem
Parameters:
-
trashItemId
Stringtarget trash item identifier (e.g. "/api/ezp/v2/content/trash/1")
-
callback
Functioncallback executed after performing the request (see Note on the callbacks usage for more info)
deleteUrlAlias
-
urlAliasId
-
callback
Delete target URL Alias
Parameters:
-
urlAliasId
Stringtarget url alias identifier (e.g. "/api/ezp/v2/content/urlaliases/0-a903c03b86eb2987889afa5fe17004eb")
-
callback
Functioncallback executed after performing the request (see Note on the callbacks usage for more info)
deleteUrlWildcard
-
urlWildcardId
-
callback
Deletes target UrlWildcard
Parameters:
-
urlWildcardId
Stringtarget url wildcard identifier (e.g. "/api/ezp/v2/content/urlwildcards/1")
-
callback
Functioncallback executed after performing the request (see Note on the callbacks usage for more info)
deleteVersion
-
versionedContentId
-
callback
Deletes target version of the content.
Parameters:
-
versionedContentId
Stringtarget version identifier (e.g. "/api/ezp/v2/content/objects/108/versions/2")
-
callback
Functioncallback executed after performing the request (see Note on the callbacks usage for more info)
emptyThrash
-
callback
Empty the trash can
Parameters:
-
callback
Functioncallback executed after performing the request (see Note on the callbacks usage for more info)
emptyTrash
-
callback
Empty the trash can
Parameters:
-
callback
Functioncallback executed after performing the request (see Note on the callbacks usage for more info)
getContentState
-
contentStatesId
-
callback
Get ObjectStates of target content
Parameters:
-
contentStatesId
Stringlink to target content's object states (should be auto-discovered from contentId)
-
callback
Functioncallback 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:
-
locationUrlAliases
Stringlink 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
-
callback
Functioncallback 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:
-
versionedContentId
Stringtarget 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).
-
callback
Functioncallback 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:
-
remoteId
Stringremote id of target content object (e.g. "30847bec12a8a398777493a4bdb10398")
-
callback
Functioncallback executed after performing the request (see Note on the callbacks usage for more info)
loadContentInfo
-
contentId
-
callback
Load single content info
Parameters:
-
contentId
Stringtarget content identifier (e.g. "/api/ezp/v2/content/objects/108")
-
callback
Functioncallback 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:
-
contentId
Stringtarget content identifier (e.g. "/api/ezp/v2/content/objects/108")
-
[languageCodes=false]
String optionalcomma separated list of language codes (ie "fre-FR,eng-GB")
-
callback
Functioncallback 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:
-
contentId
Stringtarget 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
-
callback
Functioncallback 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:
-
contentId
Stringtarget content identifier (e.g. "/api/ezp/v2/content/objects/108")
-
callback
Functioncallback executed after performing the request (see Note on the callbacks usage for more info)
loadImageVariation
-
variation
-
callback
Loads an image variation
Parameters:
-
variation
StringThe variation REST id
-
callback
FunctionCallback executed after performing the request (see Note on the callbacks usage for more info)
loadLocation
-
locationId
-
callback
Loads target location
Parameters:
-
locationId
Stringtarget location identifier (e.g. "/api/ezp/v2/content/locations/1/2/102")
-
callback
Functioncallback executed after performing the request (see Note on the callbacks usage for more info)
loadLocationByRemoteId
-
remoteId
-
callback
Loads target location by remote Id
Parameters:
-
remoteId
Stringremote id of target location (e.g. "0bae96bd419e141ff3200ccbf2822e4f")
-
callback
Functioncallback 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:
-
locationId
Stringtarget 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
-
callback
Functioncallback 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:
-
contentId
Stringtarget content identifier (e.g. "/api/ezp/v2/content/objects/108")
-
callback
Functioncallback executed after performing the request (see Note on the callbacks usage for more info)
loadObjectState
-
objectStateId
-
callback
Load target ObjectState
Parameters:
-
objectStateId
Stringtarget object state identifier (e.g. "/api/ezp/v2/content/objectstategroups/7/objectstates/5")
-
callback
Functioncallback executed after performing the request (see Note on the callbacks usage for more info)
loadObjectStateGroup
-
objectStateGroupId
-
callback
Loads target ObjectState group
Parameters:
-
objectStateGroupId
Stringtarget object state group identifier (e.g. "/api/ezp/v2/content/objectstategroups/2")
-
callback
Functioncallback executed after performing the request (see Note on the callbacks usage for more info)
loadObjectStateGroups
-
objectStateGroups
-
callback
Loads all the ObjectState groups
Parameters:
-
objectStateGroups
Stringpath to root objectStateGroups (will be replaced by auto-discovered soon)
-
callback
Functioncallback executed after performing the request (see Note on the callbacks usage for more info)
loadRelation
-
relationId
-
callback
Loads target relation
Parameters:
-
relationId
Stringtarget relation identifier (e.g. "/api/ezp/v2/content/objects/102/versions/5/relations/1")
-
callback
Functioncallback 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:
-
versionedContentId
Stringtarget 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
-
callback
Functioncallback 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:
-
callback
Functioncallback executed after performing the request (see Note on the callbacks usage for more info)
loadSection
-
sectionId
-
callback
Load single section
Parameters:
-
sectionId
Stringtarget section identifier (e.g. "/api/ezp/v2/content/sections/2")
-
callback
Functioncallback 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:
-
callback
Functioncallback executed after performing the request (see Note on the callbacks usage for more info)
loadTrashItem
-
trashItemId
-
callback
Loads target trash can item
Parameters:
-
trashItemId
Stringtarget trash item identifier (e.g. "/api/ezp/v2/content/trash/1")
-
callback
Functioncallback 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
-
callback
Functioncallback 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:
-
urlAliasId
Stringtarget url alias identifier (e.g. "/api/ezp/v2/content/urlaliases/0-a903c03b86eb2987889afa5fe17004eb")
-
callback
Functioncallback executed after performing the request (see Note on the callbacks usage for more info)
loadUrlAliases
-
urlAliases
-
callback
Loads all the global UrlAliases
Parameters:
-
urlAliases
Stringlink to root UrlAliases resource (should be auto-discovered)
-
callback
Functioncallback executed after performing the request (see Note on the callbacks usage for more info)
loadUrlWildcard
-
urlWildcardId
-
callback
Loads target UrlWildcard
Parameters:
-
urlWildcardId
Stringtarget url wildcard identifier (e.g. "/api/ezp/v2/content/urlwildcards/1")
-
callback
Functioncallback executed after performing the request (see Note on the callbacks usage for more info)
loadUrlWildcards
-
urlWildcards
-
callback
Loads all UrlWildcards
Parameters:
-
urlWildcards
Stringlink to root UrlWildcards resource (should be auto-discovered)
-
callback
Functioncallback executed after performing the request (see Note on the callbacks usage for more info)
loadUserDrafts
-
userId
-
callback
Loads user drafts
Parameters:
-
userId
Stringtarget user identifier (e.g. "/api/ezp/v2/user/users/14")
-
callback
Functioncallback 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:
-
contentId
Stringtarget content identifier (e.g. "/api/ezp/v2/content/objects/108")
-
callback
Functioncallback 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:
-
subtree
Stringsource subtree location
-
targetLocation
Stringlocation where source subtree should be moved
-
callback
Functioncallback 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:
-
contentTypeId
StringContent Type for new Content object (e.g.: /api/v2/ezp/content/type/1)
-
locationCreateStruct
LocationCreateStructcreate structure for a Location object, where the new Content object will be situated
-
language
StringThe 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:
-
language
StringThe language code (eng-GB, fre-FR, ...)
Returns:
newLocationCreateStruct
-
parentLocationId
Returns create structure for Location object
Parameters:
-
parentLocationId
StringReference 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:
-
identifier
Stringunique ObjectState identifier (e.g. "some-new-state")
-
languageCode
StringThe language code (eng-GB, fre-FR, ...)
-
priority
Number -
names
ArrayMulti language value (see example)
-
descriptions
ArrayMulti 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:
-
identifier
Stringunique ObjectStateGroup identifier (e.g. "some-new-group")
-
languageCode
StringThe language code (eng-GB, fre-FR, ...)
-
names
ArrayMulti 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:
-
destination
Stringreference 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:
-
identifier
Stringunique section identifier (e.g. "media")
-
name
Stringsection name (e.g. "Media")
Returns:
newUrlAliasCreateStruct
-
languageCode
-
resource
-
path
Returns create structure for UrlAlias
Parameters:
-
languageCode
StringThe language code (eng-GB, fre-FR, ...)
-
resource
StringeZ Publish resource you want to create alias for
-
path
Stringthe 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:
-
sourceUrl
Stringnew url wildcard
-
destinationUrl
Stringexisting resource where wildcard should point
-
forward
Booleanweather 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:
-
identifier
Stringunique 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:
-
versionedContentId
Stringtarget version identifier (e.g. "/api/ezp/v2/content/objects/108/versions/2")
-
callback
Functioncallback executed after performing the request (see Note on the callbacks usage for more info)
recover
-
trashItemId
-
[destination]
-
callback
Restores target trashItem
Parameters:
-
trashItemId
Stringtarget 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
-
callback
Functioncallback executed after performing the request (see Note on the callbacks usage for more info)
setContentState
-
contentStatesId
-
objectStates
-
callback
Set ObjectStates of a content
Parameters:
-
contentStatesId
Stringlink to target content's object states (should be auto-discovered from contentId)
-
objectStates
Array -
callback
Functioncallback 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:
-
subtree
Stringsource subtree location
-
targetLocation
Stringlocation with which subtree location should be swapped
-
callback
Functioncallback 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:
-
versionedContentId
Stringtarget version identifier (e.g. "/api/ezp/v2/content/objects/108/versions/2")
-
contentUpdateStruct
ContentUpdateStructobject describing update to the draft
-
callback
Functioncallback executed after performing the request (see Note on the callbacks usage for more info)
updateContentMetadata
-
contentId
-
contentMetadataUpdateStruct
-
callback
Update target content metadata.
Parameters:
-
contentId
Stringtarget content identifier (e.g. "/api/ezp/v2/content/objects/108")
-
contentMetadataUpdateStruct
ContentMetadataUpdateStructobject describing update of the content metadata
-
callback
Functioncallback 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:
-
locationId
Stringtarget location identifier (e.g. "/api/ezp/v2/content/locations/1/2/102")
-
locationUpdateStruct
LocationUpdateStructobject describing changes to target location
-
callback
Functioncallback executed after performing the request (see Note on the callbacks usage for more info)
updateObjectState
-
objectStateId
-
objectStateUpdateStruct
-
callback
Update target ObjectState
Parameters:
-
objectStateId
Stringtarget object state identifier (e.g. "/api/ezp/v2/content/objectstategroups/7/objectstates/5")
-
objectStateUpdateStruct
ObjectStateUpdateStructobject describing changes to target ObjectState
-
callback
Functioncallback executed after performing the request (see Note on the callbacks usage for more info)
updateObjectStateGroup
-
objectStateGroupId
-
objectStateGroupUpdateStruct
-
callback
Update target ObjectState group
Parameters:
-
objectStateGroupId
Stringtarget object state group identifier (e.g. "/api/ezp/v2/content/objectstategroups/2")
-
objectStateGroupUpdateStruct
ObjectStateGroupUpdateStructobject describing changes to target ObjectState group
-
callback
Functioncallback executed after performing the request (see Note on the callbacks usage for more info)
updateSection
-
sectionId
-
sectionInputStruct
-
callback
Update target section
Parameters:
-
sectionId
Stringtarget section identifier (e.g. "/api/ezp/v2/content/sections/2")
-
sectionInputStruct
SectionInputStructobject describing updates to the section
-
callback
Functioncallback executed after performing the request (see Note on the callbacks usage for more info)