Collection.SetPublisher
  • 27 Jul 2021
  • 3 Minutes to read
  • Contributors
  • Dark
    Light
  • PDF

Collection.SetPublisher

  • Dark
    Light
  • PDF

Description

Updates or creates a new publisher for the specified collection.

URL parameters

URL parameter ordering

The URL parameters below are listed in the order they should be entered in the API URL.

Name Required Type Description
CollectionID True numeric Unique identifier of the collection.
Method True string Specified method of publishing. The options are listed below.
ViewID False numeric Unique identifier of the view.
FileFormat False string CSV, TSV, XML, JSON, and XLSX. Default is CSV.
FileName False string Naming conventions for the file. You can use parameters here.
FileIncludeHeader False boolean Yes, NoYes to add field headers to row one in the published file. Default is Yes.
PublishWhenAgentCompletes False boolean Yes, NoYes to publish when the agent completes. No to publish manually. When not specified, no change is made unless initializing a new publisher which defaults to No.
ItemStatusIncludeColumn False boolean Yes, No – Yes to include the column in the data file. Default is No.

Email

Method = Email

Name Required Type Description
EmailAddress True string Email where the file should be emailed to.
EmailSubject False string Subject of published email.

FTP

Method = FTP

Name Required Type Description
FtpServer True string Name of the FTP server.
FtpPort False numeric Default is 21.
FtpProtocol False string FTP, SFTP, FTPSImplicit, FTPSExplicit. Default is FTP.
FtpDirectory False string Directory where file should be published.
FtpUser False string Username to access FTP.
FtpPassword False string Password of user to access FTP.
FtpUsePassive False boolean Yes/True, No/False . Yes to use passive transfer mode. Default is Yes.
FtpSSLProtocol False string The security protocol to use. Possible values: Default, Ssl2, Ssl3, Tls, Tls11, Tls12. Default is Default.
IncludePackages False boolean Yes/True, No/False. Yes to include images/files when publishing to FTP. Default is No.

AmazonS3

Method = AmazonS3

Name Required Type Description
AmazonS3AuthenticationToken True string AWS Access Key ID.
AmazonS3SignRequestToken True string AWS Secret Access Key.
AmazonS3BucketPath True string Path to bucket in S3.
AmazonS3BucketRegion True string The Amazon S3 endpoint for the selected bucket. Click here to see a list of valid endpoints.

AzureStorage

Method = AzureStorage

Name Required Type Description
MicrosoftAzureStorageAccountName True string Name of the Microsoft Azure Storage Account.
MicrosoftAzureStorageAccountKey True string Account Key for the Azure account.
MicrosoftAzureStorageContainerName True string Name of the Container.

Dropbox

Method = Dropbox

Name Required Type Description
DropBoxFolder False string Use a file path beginning with the first sub-folder, for example: Mozenda/DataFeeds/Agent1.

Google Cloud Storage

Method = GoogleCloud

Name Required Type Description
GoogleCloudStorageBucket True String Bucket name in Google Cloud Storage
GoogleCloudStorageFolder False String use a file path beginning with the first sub-folder, for example: Mozenda/DataFeeds/Agent1.
Don't forget your key!

You should have a Google Cloud Key JSON assigned to your Google Cloud account. Copy and paste the entire key and enter it into the post-body for the GoogleCloudCredentialJSON.

Google Drive

Method = Google

Name Required Type Description
GoogleFolder False string Use a file path beginning with the first sub-folder, for example: Mozenda/DataFeeds/Agent1.
Dropbox & Google Drive

You will have to use the web console to connect your Mozenda account to your Google Drive and Dropbox accounts.

Optional parameters for ItemStatusInclude

Name Required Type Description
ItemStatusIncludeAdded False boolean Yes/True, No/False. Include added items.
ItemStatusIncludeChanged False boolean Yes/True, No/False. Include changed items.
ItemStatusIncludeUnchanged False boolean Yes/True, No/False. Include unchanged items.
ItemStatusIncludeDeleted False boolean Yes/True, No/False. Include deleted items.
ItemStatusIncludeChangeMarkup False boolean Yes/True, No/False. Include a column with the change markup.
Note

These item status filtering options have no effect unless ItemStatusIncludeColumn is True.

Returns

Name Type Description
Result string Success if the operation was successful.

Sample request

curl -X GET 'https://api.mozenda.com/rest?WebServiceKey=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX&Service=Mozenda10&Operation=Collection.SetPublisher&CollectionID=1099&Method=Email&EmailAddress=MyEmail@Provider.com'

Sample responses

XML

<?xml version="1.0" encoding="utf-8" ?>
<SetPublisherResponse
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
	<Result>Success</Result>
</SetPublisherResponse>

JSON (add &ResponseFormat=JSON)

{
    "JsonResult": {
        "Command": "Collection.SetPublisher",
        "AutoLoggedIn": false,
        "WebConsoleKey": "",
        "Result": "Success",
        "ErrorCode": "",
        "ErrorDescription": "",
        "ErrorList": [],
        "ExecutionTime": {
            "Ticks": 0,
            "Days": 0,
            "Hours": 0,
            "Milliseconds": 0,
            "Minutes": 0,
            "Seconds": 0,
            "TotalDays": 0,
            "TotalHours": 0,
            "TotalMilliseconds": 0,
            "TotalMinutes": 0,
            "TotalSeconds": 0
        }
    }
}

Additional Information

  • A publisher cannot be created with a Method of “None”, it must be FTP, Email, AmazonS3 Azure, Dropbox, Google Cloud, or Google.
  • A publisher will only update the fields related to your Method (i.e – If Method is FTP, only the common optional fields and the FTP fields will be updated).
  • If you are creating a new publisher any fields you don’t provide (that are not required), will be set to default values.
  • If you have manually setup a schedule for your publisher in the Web Console’s publish dialog, then do not provide the PublishWhenAgentCompletes parameter or the schedule will be deleted.

Was this article helpful?