Is there a REST API for creating/updating Email Digests in the user Settings? I didn't see one and wanted to confirm that.
These...

Or, if there is no REST API, what about in the Widget API or In-Process API?
Thanks.
Is there a REST API for creating/updating Email Digests in the user Settings? I didn't see one and wanted to confirm that.
These...

Or, if there is no REST API, what about in the Widget API or In-Process API?
Thanks.
For anyone else stumbling on this thread, here is some widget API JS code that will create a new group subscription and return the subscription info as JSON. This code returns JSON instead of HTML and would be called using the /api.ashx/v2/scripted REST endpoint.
-----
core_v2_page.SetContentType('application/json');
/* normally these would be passed in, but for demo purposes they are hard-coded */
var context = "group";
var contextId = 6; // the group ID
var frequency = 7; // # of days - 0, 1, 7
var sub = core_v2_emailDigest.Create(context, contextId, frequency);
/* if we needed to update an existing sub, we would do this */
// var existingSub = core_v2_emailDigest.GetByGroup(contextId);
// var sub = core_v2_emailDigest.Update(existingSub.Id, frequency);
/* return all of the sub properties as a JSON string*/
return JSON.stringify({
id: sub.Id,
userId: sub.UserId,
context: sub.Context,
contextId: sub.ContextId,
dateCreated: sub.DateCreated,
frequencyInDays: sub.FrequencyInDays,
nextSendDate: sub.NextSendDate
});
For anyone else stumbling on this thread, here is some widget API JS code that will create a new group subscription and return the subscription info as JSON. This code returns JSON instead of HTML and would be called using the /api.ashx/v2/scripted REST endpoint.
-----
core_v2_page.SetContentType('application/json');
/* normally these would be passed in, but for demo purposes they are hard-coded */
var context = "group";
var contextId = 6; // the group ID
var frequency = 7; // # of days - 0, 1, 7
var sub = core_v2_emailDigest.Create(context, contextId, frequency);
/* if we needed to update an existing sub, we would do this */
// var existingSub = core_v2_emailDigest.GetByGroup(contextId);
// var sub = core_v2_emailDigest.Update(existingSub.Id, frequency);
/* return all of the sub properties as a JSON string*/
return JSON.stringify({
id: sub.Id,
userId: sub.UserId,
context: sub.Context,
contextId: sub.ContextId,
dateCreated: sub.DateCreated,
frequencyInDays: sub.FrequencyInDays,
nextSendDate: sub.NextSendDate
});