Functionality
User Site
The JavaScript on the user-site can call the API end-point and obtain these pieces of information:
Base URL
The base URL for these requests is typically:
[Your Storefront URL]/ROI360/RightMarket Core API/Interface.ashx
Endpoints
1. DocumentsGet
Retrieves detailed information and reorder status for a set of user documents.
- Method:
POST - Description: Fetches properties such as product display name, archive status, retirement status, and calculated reorder eligibility for the specified document IDs.
- Query Parameters:
method(string, required): Must beDocumentsGet.arrayOfIds(string, required): A JSON-encoded array of document IDs (example:"[123,345,678]").
- Authentication: Requires the user to be logged in to the Storefront.
- Example Calls:
cURL
```bash curl -X POST "http://your-storefront-url.com/ROI360/RightMarket%20Core%20API/Interface.ashx?method=DocumentsGet&arrayOfIds=%5B6749%2C6750%2C6751%2C6752%2C6753%2C6754%2C6755%2C6756%5D" \ -H "Cookie: .ASPXAUTH=..." ```JavaScript (Console Test)
```javascript // Please copy and paste this code into your browser console. // Finally, hit the Enter key to test the "DocumentsGet" API endpoint: const arrayOfIds = [6749,6750,6751,6752,6753,6754,6755,6756]; const fd = new FormData(); fd.append("arrayOfIds", JSON.stringify(arrayOfIds)); const options = { method: "POST", body: fd }; const response = await fetch("/ROI360/RightMarket Core API/Interface.ashx?method=DocumentsGet", options); const data = await response.json(); const map = new Map(); for (const i of data.Items) map[i.UserDocumentID] = i; for (const id of arrayOfIds) console.log(id.toString() + " = " + map[id].ReorderStatus); ``` - Response:
application/json{ "Message": string, "Items": [ { "UserDocumentID": number, "ExternalDocID": string, "ProductID": number, "Description": string, "OwnerID": number, "TimeLastAccessed": date-time string - can be null, "ReorderStatus": boolean, "Product": { "ProductID": number, "HTML_DisplayName": string, "b_IsStaged": boolean, "b_IsArchived": boolean, "b_IsRetired": boolean, "b_IsDeleted": boolean, "AllowedOperations": number, "LatestReleaseId": number - can be null }, "LatestRelease": same as "Product" - can be null } ] }The ReorderStatus boolean property is calculated based on the Design’s “Retired” and “Archived” status. It also takes into account the “LatestRelease” properties.
2. IsSelfRegistrationEnabled
Checks if the Storefront has self-registration enabled.
- Method:
GET - Description: Returns the global Storefront setting for self-registration.
- Query Parameters:
method(string, required): Must beIsSelfRegistrationEnabled.
- Authentication: Requires the user to be logged in to the Storefront.
- Example Calls:
cURL
```bash curl -X GET "http://your-storefront-url.com/ROI360/RightMarket%20Core%20API/Interface.ashx?method=IsSelfRegistrationEnabled" \ -H "Cookie: .ASPXAUTH=..." ```JavaScript (Fetch)
```javascript const response = await fetch('/ROI360/RightMarket%20Core%20API/Interface.ashx?method=IsSelfRegistrationEnabled'); const isEnabled = await response.json(); console.log('Self-registration enabled:', isEnabled); ``` - Response:
application/jsontrueif enabled,falseotherwise.
3. DoesUserExist
Checks for the existence of a user in the Storefront database by their logon name.
- Method:
GET - Description: Verifies if a specific username (logon name) is already registered.
- Query Parameters:
method(string, required): Must beDoesUserExist.username(string, required): The logon name to check.
- Authentication: Requires the user to be logged in to the Storefront.
- Example Calls:
cURL
```bash curl -X GET "http://your-storefront-url.com/ROI360/RightMarket%20Core%20API/Interface.ashx?method=DoesUserExist&username=testuser" \ -H "Cookie: .ASPXAUTH=..." ```JavaScript (Fetch)
```javascript const response = await fetch('/ROI360/RightMarket%20Core%20API/Interface.ashx?method=DoesUserExist&username=testuser'); const exists = await response.json(); console.log('User exists:', exists); ``` - Response:
application/jsontrueif the user exists,falseotherwise.
4. SendEmail
Send an email using a named, server-hosted template. Templates live under the ROI360 extension folder in the web application at ~/ROI360/RightMarket Core API/EmailTemplates/.
- Method:
POST - Description: Loads a template (JSON header + HTML body), resolves tokens from the caller-provided inputs and the Storefront user/system data, then sends the email using the site’s SMTP settings.
- Query Parameters / Form fields:
method(string, required): Must beSendEmail.email(string, required): Template name (basename). ExampleregisterUserloadsregisterUser.jsonandregisterUser.html.kvps(JSON object, optional): A JSON dictionary of input tokens used for{Input:Key}replacements. Example:{"Recipient":"user@example.com"}.
-
Authentication / Authorization: Requires a logged-in Storefront user session. The endpoint will only send emails when the extension is active.
- Template format:
- Header JSON file:
{templateName}.json— must containTo,From, andSubjectstring fields. These may include tokens. - Body HTML file:
{templateName}.html— contains the message body and may include tokens. -
Example header (
registerUser.json):{ "To": "{Input:Recipient}", "From": "noreply@rightmarket.com", "Subject": "{UserField:UserProfileFirstName} {UserField:UserProfileLastName} has invited you to RightMarket!" } -
Example body (
registerUser.html):<p>{UserField:UserProfileFirstName} {UserField:UserProfileLastName} has invited you to RightMarket.</p> <p><a href="https://{SystemProperty:StorefrontName}.rightmarket.com/UserJLogin.aspx?view=selfregistration&source=invite&email={Input:Recipient}">Click here to register</a></p>
- Header JSON file:
- Supported tokens:
{Input:Key}— value taken from thekvpsargument provided by the caller.{UserField:FieldName}— user profile field fromDataGlobal.UserProfileOptionSet.AllFieldDefinitions; resolved for the currently logged-in user or fromkvpsas a fallback.{SystemProperty:StorefrontName}— the deployment name derived from the storefront root path.
- Example Calls:
cURL
```bash curl -X POST "http://your-storefront-url.com/ROI360/RightMarket%20Core%20API/Interface.ashx?method=SendEmail&email=registerUser&kvps={\"Recipient\":\"invitee@example.com\"}" \ -H "Cookie: .ASPXAUTH=..." ```JavaScript (Fetch)
```javascript const params = new URLSearchParams(); params.append('method', 'SendEmail'); params.append('email', 'registerUser'); params.append('kvps', JSON.stringify({ Recipient: 'invitee@example.com' })); const response = await fetch('/ROI360/RightMarket Core API/Interface.ashx', { method: 'POST', body: params }); const result = await response.json(); console.log(result); // { sent: true } ``` - Response:
application/json- On success:
{ "sent": true }with HTTP 200 - On failure: HTTP 400 with a textual error describing missing template, token resolution error, or send failure.
- On success:
- Logging: Successful and failed attempts are logged via the Storefront logging API and include template name and recipient information.