This content has been marked as final. Show 5 replies
What you are trying to do will not work for several reasons:
- you cannot miiror assets, you need to publish them
- you cannot publish assets without approving them
- there is not OOTB REST support for publishing and approving
Mirroring is used to copyl database rows (and associated files from url columns) from one server to the other.
To approve your asset the easiest way (probably) is to call the ApproveAssets element (you need to look for the complete path, don't know it from the top of my head). In your code you would need to handle the responses, this might be a real challenge.
To publish you would need to call PublishApproveAssets to create a publish session.
You can call these elements by using ics.CallElement. Using that method from a custom REST service might be not possible. I just don't know. What will work if you would create a CSElement and a SiteEntry and have your client call those over http. Bu in that case you can't use the auto generate jersey client.
Now, if we take one step back: what is the underlying requirement that drives you to puiblish the asset programatically?
Thanks Dolf for your reply.
I have already tried with ICS.CallElement("CustomPublishApproveAsset") which is publishing only the approved asset but it couldn't publish any pages where this asset is associated or where it has some dependency. Can you please throw some light on this?
And I also need the API ICS.CallElement("ApproveAssets") to approve all the assets with it's dependency.
N.B: CustomPublishApproveAsset is my custom element taking the same code from PublishApprovedAssets.
Approval works the other way around: it blocks the publishing of assets that have references to assets that are not published. In your case the Page would be blocked if it would reference the article. The article does not know on which page it will show up as it is the page that is looking up the article. On your case you would need to approve the Page too. Not knowing what pages to approve might be a challenge. The larger question is probably: why do you need to approve/publish a page when you insert an article?
The ApproveAssets element has a recursive option, you may need to call it several times. This is not the easiest part of the product to mock around with, be carefull.
What is your underlying business requirement?
I have one custom basic asset type 'DMPContent'. I have few asset(say asset1) of type DMPContent Now let's say we have one page 'TestPage' where I have associated one asset(asset1) of type DMPContent. Now while I am trying to publish the asset(i.e asset1) it should also publish the page TestPage along with asset1. And also the template which I need to render the asset that needs to be published - this is our requirement.
Please suggest some solution in this.
You will need approve your page and template too. For sites it is ok to publish asset1 without the page and the template as the asset can be used on another page or migth be retrieved via sql or a search.