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.