Publishing destinations via script
It looks like the formatting for publishing pages has changed in
the web services recently? It used to be that you set
'destination' => 'name-of-destination', but now it
looks like you set an array of 'destinations' (plural)
with identifiers, correct?
I'm making a script that will publish multiple pages on different sites. I'm using the following:
$publish = $client->publish ( array (
'authentication' => $auth,
'publishInformation' => array(
'identifier' => array(
'type' => 'page',
'id' => $asset["id"] ),
'destinations' => array(
'type' => 'destination',
'path' => array(
'path' => 'name-of-destination',
'siteId' => $asset["siteId"] ) ),
'unpublish' => false )
)
);
However, this is still publishing to all destinations. I want it to only publish to the one I specify. How do I make that happen?
I've tried putting 'name-of-destination' as
'/name-of-destination' (with a slash) too. Thanks for
the help.
Discussions are closed to public comments.
If you need help with Cascade CMS please
start a new discussion.
Keyboard shortcuts
Generic
| ? | Show this help |
|---|---|
| ESC | Blurs the current field |
Comment Form
| r | Focus the comment reply box |
|---|---|
| ^ + ↩ | Submit the comment |
You can use Command ⌘ instead of Control ^ on Mac
1 Posted by Wing Ming Chan on 04 Aug, 2015 12:15 AM
Hi,
The
destinationsproperty should point to an array ofstdClass(identifier) objects, or to an array of arrays (containingtypeandpath), not to a simple array.<complexType name="destination-list"> <sequence> <element maxOccurs="unbounded" minOccurs="0" name="destination" type="impl:identifier"/> </sequence> </complexType>Wing
2 Posted by thugsb on 04 Aug, 2015 02:58 PM
Can you show me what that would look like for the PHP code above please?
3 Posted by Wing Ming Chan on 04 Aug, 2015 03:02 PM
I don't work with raw code any more. Therefore, I have not tested the code. But try the following:
$publish = $client->publish ( array ( 'authentication' => $auth, 'publishInformation' => array( 'identifier' => array( 'type' => 'page', 'id' => $asset["id"] ), 'destinations' => array( array( 'type' => 'destination', 'path' => array( 'path' => 'name-of-destination', 'siteId' => $asset["siteId"] ) ) ), 'unpublish' => false ) ) );In case you have not looked at my library, you might want to check it out.
Wing
4 Posted by thugsb on 04 Aug, 2015 03:08 PM
That works, thanks!
thugsb closed this discussion on 04 Aug, 2015 03:08 PM.