Can we Create Email Content via Rest API?

Hi,

As what subject says, I have a datamapper and template for sending emails with Mandrill.

Is it possible to use existing datamapper/template and use Rest API to trigger the send in Workflow?

Thank you in advanced.

Kind regards,
E

Hello @edanting,

Yes, this is possible.

Next to the following two links I don’t have any working example available, unfortunately.

Hi Marten,

Thanks for that. Although I have seen this REST api doc before posting this.
I find it bit difficult to understand.

My understanding though is as follow , correct me If Im mistaken:

  1. If I have a data file and my template(email). First I would upload this datafile to file store? This will generate a data file ID
  2. I then call Data mapping service 1. Running a Data Mapping Operation (Using JSON) using the data fileID, this is to give me operation ID.
  3. Then I call Get Operation result using operation ID to obtain the data set ID?
  4. I then Process Content Creation (By Data Set ID) (JSON) call this EP to trigger email sending using the data set ID.

Is this correct? Im deducing if I trigger datamapping (2), I would get the OperationID straight away but it hasnt really started processing. I am wondering are these operation asynchronous?

Thank you

These steps will be as follows:

Step Description URL
1. Authenticate with Server <Origin>/serverengine/html/cookbook/examples/auth/auth-login-server.html
2. Upload Data File to File Store <Origin>/serverengine/html/cookbook/examples/fs/fs-datafile-upload.html
3. Upload DataMapper configuration to File Store <Origin>/serverengine/html/cookbook/examples/fs/fs-datamapper-upload.html
4. Upload Email Template to File Store <Origin>/serverengine/html/cookbook/examples/fs/fs-template-upload.html
5. Run Data Mapping operation <Origin>/serverengine/html/cookbook/examples/dm/dm-process.html
6. Retrieve Data Records with Data Set ID <Origin>/serverengine/html/cookbook/examples/dse/dse-get-datarecords.html
7. Create Email Content <Origin>/serverengine/html/cookbook/examples/cce/cce-process-by-dre-json.html

*<Origin>: This can be http://localhost:9340, for example.

1 Like

Wow thank you for this Marten. Although that seems a lot of operation no wonder the plugins are more user friendly and intuitive.

Questions:

  1. Im assuming they can be run synchronously so each step waits for the operation to finish for the next operation to happen? Im asking because running Connect operation (such datamapping) has an EP to check for operation progress to see how far the process is going.

  2. Im also assuming any data uploaded to filestore is deleted once clean up has triggered. Does this include configuration/templates uploaded this way?

Thank you.

The Clean-up service will eventually delete files when the parameter persistent is set to false. These files will remain in the File Store until these files are manually deleted when this parameter is set to true.

1 Like