tag:help-archives.hannonhill.com,2010-02-09:/discussions/web-services/1531-publishing-destinations-via-scriptCascade CMS: Discussion 2018-10-18T20:37:38Ztag:help-archives.hannonhill.com,2010-02-09:Comment/375548722015-08-03T20:42:02Z2015-08-03T20:42:02ZPublishing destinations via script<div><p>It looks like the formatting for publishing pages has changed in
the web services recently? It used to be that you set
<code>'destination' => 'name-of-destination'</code>, but now it
looks like you set an array of <code>'destinations'</code> (plural)
with identifiers, correct?</p>
<p>I'm making a script that will publish multiple pages on
different sites. I'm using the following:</p>
<pre>
<code>$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 )
)
);</code>
</pre>
<p>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?</p>
<p>I've tried putting <code>'name-of-destination'</code> as
<code>'/name-of-destination'</code> (with a slash) too. Thanks for
the help.</p></div>thugsbtag:help-archives.hannonhill.com,2010-02-09:Comment/375548722015-08-04T00:15:11Z2015-08-04T12:29:03ZPublishing destinations via script<div><p>Hi,</p>
<p>The <code>destinations</code> property should point to an array
of <code>stdClass</code> (<code>identifier</code>) objects, or to
an array of arrays (containing <code>type</code> and
<code>path</code>), not to a simple array.</p>
<pre>
<complexType name="destination-list">
<sequence>
<element maxOccurs="unbounded" minOccurs="0" name="destination" type="impl:identifier"/>
</sequence>
</complexType>
</pre>
<p>Wing</p></div>Wing Ming Chantag:help-archives.hannonhill.com,2010-02-09:Comment/375548722015-08-04T14:58:12Z2015-08-04T14:58:12ZPublishing destinations via script<div><p>Can you show me what that would look like for the PHP code above
please?</p></div>thugsbtag:help-archives.hannonhill.com,2010-02-09:Comment/375548722015-08-04T15:02:01Z2015-08-04T15:04:32ZPublishing destinations via script<div><p>I don't work with raw code any more. Therefore, I have not
tested the code. But try the following:<br></p>
<pre>
$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 )
)
);
</pre>
<p>In case you have not looked at my library, you might want to
check it out.</p>
<p>Wing</p></div>Wing Ming Chantag:help-archives.hannonhill.com,2010-02-09:Comment/375548722015-08-04T15:08:41Z2015-08-04T15:08:41ZPublishing destinations via script<div><p>That works, thanks!</p></div>thugsb