EXM API

deterministicFetch()

EXM.deterministicFetch(endpoint) - Performs a fetch operation that is deterministic based on the arguments provided. Supports GET and POST.

GET:

const endpoint = 'https://my.endpoint.io/'
const res = await EXM.deterministicFetch(endpoint);
const json = res.asJSON()
// json -> { "key": "value", ... } 

POST:

const req = await EXM.determinsiticFetch(
  "https://my.endpoint.io",
  {
    method: "POST",
    headers: {
      "Content-Type": "application/json",
    },
    body: JSON.stringify(body),
  },
);

const result = req.asJSON();

getDate()

EXM.getDate() - returns the current date as a Date object which supports all JavaScript Date methods like .getTime().

const timestamp = EXM.getDate().getTime()
// timestamp -> 1690896994

Last updated

mem.tech ยฉ 2023