Collection.SetPublisher
  • 14 May 2024
  • 3 Minutes to read
  • Contributors
  • Dark
    Light
  • PDF

Collection.SetPublisher

  • Dark
    Light
  • PDF

Article summary

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.

NameRequiredTypeDescription
CollectionIDTruenumericUnique identifier of the collection.
MethodTruestringSpecified method of publishing. The options are listed below.
ViewIDFalsenumericUnique identifier of the view.
FileFormatFalsestringCSV, TSV, XML, JSON, and XLSX. Default is CSV.
FileNameFalsestringNaming conventions for the file. You can use parameters here.
FileIncludeHeaderFalsebooleanYes, NoYes to add field headers to row one in the published file. Default is Yes.
PublishWhenAgentCompletesFalsebooleanYes, 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.
ItemStatusIncludeColumnFalsebooleanYes, No – Yes to include the column in the data file. Default is No.
FileCompressionFormatFalseStringGZip, SevenZip, Zip
FilePackageCompressionFormatFalseStringTarGZip, SevenZip, Tar, Zip

Email

Method = Email

NameRequiredTypeDescription
EmailAddressTruestringEmail where the file should be emailed to.
EmailSubjectFalsestringSubject of published email.

FTP

Method = FTP

NameRequiredTypeDescription
FtpServerTruestringName of the FTP server.
FtpPortFalsenumericDefault is 21.
FtpProtocolFalsestringFTP, SFTP, FTPSImplicit, FTPSExplicit. Default is FTP.
FtpDirectoryFalsestringDirectory where file should be published.
FtpUserFalsestringUsername to access FTP.
FtpPasswordFalsestringPassword of user to access FTP.
FtpUsePassiveFalsebooleanYes/True, No/False . Yes to use passive transfer mode. Default is Yes.
FtpSSLProtocolFalsestringThe security protocol to use. Possible values: Default, Ssl2, Ssl3, Tls, Tls11, Tls12. Default is Default.
IncludePackagesFalsebooleanYes/True, No/False. Yes to include images/files when publishing to FTP. Default is No.

AmazonS3

Method = AmazonS3

NameRequiredTypeDescription
AmazonS3AuthenticationTokenTruestringAWS Access Key ID.
AmazonS3SignRequestTokenTruestringAWS Secret Access Key.
AmazonS3BucketPathTruestringPath to bucket in S3.
AmazonS3BucketRegionTruestringThe Amazon S3 endpoint for the selected bucket. Click here to see a list of valid endpoints.

AzureStorage

Method = AzureStorage

NameRequiredTypeDescription
MicrosoftAzureStorageAccountNameTruestringName of the Microsoft Azure Storage Account.
MicrosoftAzureStorageAccountKeyTruestringAccount Key for the Azure account.
MicrosoftAzureStorageContainerNameTruestringName of the Container.

Dropbox

Method = Dropbox

NameRequiredTypeDescription
DropBoxFolderFalsestringUse a file path beginning with the first sub-folder, for example: Mozenda/DataFeeds/Agent1.

Google Cloud Storage

Method = GoogleCloud

NameRequiredTypeDescription
GoogleCloudStorageBucketTrueStringBucket name in Google Cloud Storage
GoogleCloudStorageFolderFalseStringuse 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

NameRequiredTypeDescription
GoogleFolderFalsestringUse 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

NameRequiredTypeDescription
ItemStatusIncludeAddedFalsebooleanYes/True, No/False. Include added items.
ItemStatusIncludeChangedFalsebooleanYes/True, No/False. Include changed items.
ItemStatusIncludeUnchangedFalsebooleanYes/True, No/False. Include unchanged items.
ItemStatusIncludeDeletedFalsebooleanYes/True, No/False. Include deleted items.
ItemStatusIncludeChangeMarkupFalsebooleanYes/True, No/False. Include a column with the change markup.
Note

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

Returns

NameTypeDescription
ResultstringSuccess 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=131794&PublishWhenAgentCompletes=True&ViewID=151876&FileIncludeHeader=True&FileFormat=JSON&FileCompressionformat=ZiP&FilePackageCompressionFormat=SevenZip&Method=AmazonS3&IncludePackages=True&ItemStatusIncludeColumn=False&AmazonS3AuthenticationToken=AuthenticationToken&AmazonS3SignRequestToken=SignRequestToken&AmazonS3BucketPath=moztestingbucket/gzipped&AmazonS3BucketRegion=bucketregion.amazonaws.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?