Skip to main content

Check the image is exist or not

Checks whether a generated result image already exists. Used as a guard before calling Convert Image from base64 to Image.

MethodGET
Path/api/v1/baseToUrl
Full URLhttps://backend.4dnum.com/api/v1/baseToUrl
Path collision in the source document

The source document lists this endpoint and Convert Image from base64 to Image under the same path and method (GET /api/v1/baseToUrl). They differ only by the presence of the image parameter. Confirm the intended routing with your PIC before implementing — this endpoint may have a distinct path that was mis-copied in the document.

Request​

AttributeTypeMandatoryExampleDescription
modeStringYesdarkdark = dark mode, light = light mode.
dateStringYes20240228Draw date, YYYYMMDD. No dashes — unlike every other endpoint.
typeStringYesSpecial_CashSweepCompany full name, not the abbreviation.
languageStringYesenen = English, cn = Chinese, my = Malay.
Two format differences
  1. date uses YYYYMMDD here, while every other endpoint uses YYYY-MM-DD.
  2. type takes the company full name with underscores (Special_CashSweep), not the abbreviation (CS) used elsewhere. See Company Codes.

Response​

AttributeTypeExampleDescription
existBooleanfalseIf false, call Convert Image from base64 to Image to generate it.
successBooleantrueWhether the check itself succeeded.

Example​

curl "https://backend.4dnum.com/api/v1/baseToUrl?mode=dark&date=20240228&type=Special_CashSweep&language=en"
{
"exist": false,
"success": true
}

Typical flow​

const params = {
mode: 'dark',
date: '20240228',
type: 'Special_CashSweep',
language: 'en',
};

const check = await get(`/baseToUrl?${new URLSearchParams(params)}`);

if (!check.exist) {
// Render the result client-side, then upload it
const {s3_url} = await get(
`/baseToUrl?${new URLSearchParams({...params, image: base64Png})}`
);
share(s3_url);
}