//native
type Zoho = {
token: string;
baseUrl: string;
};
/**
* Publish API Get Record Detail View
* This API fetches the data displayed in the detail view of a record, which is identified by the ID value passed. This API will not fetch the records displayed in the related data blocks of the detail view.
*/
export async function main(
auth: Zoho,
account_owner_name: string,
app_link_name: string,
report_link_name: string,
record_ID: string,
privatelink: string | undefined,
field_config: string | undefined,
fields: string | undefined,
) {
const url = new URL(
`${auth.baseUrl}/creator/v2.1/publish/${account_owner_name}/${app_link_name}/report/${report_link_name}/${record_ID}`,
);
for (const [k, v] of [
["privatelink", privatelink],
["field_config", field_config],
["fields", fields],
]) {
if (v !== undefined && v !== "" && k !== undefined) {
url.searchParams.append(k, v);
}
}
const response = await fetch(url, {
method: "GET",
headers: {
Authorization: "Zoho-oauthtoken " + auth.token,
},
body: undefined,
});
if (!response.ok) {
const text = await response.text();
throw new Error(`${response.status} ${text}`);
}
return await response.json();
}
Submitted by hugo697 235 days ago