Call External API in Forge Custom UI

Have any one been able to able to call an external API from Forge Custom UI.

I was able to achieve the same in UI Kit. However with Custom UI so far I am only able to make Jira internal API calls…

Any code samples would be really appreaciated.

Thanks,
Majo

1 Like

Without code examples of your problem it might be difficult to troubleshoot.

This is a custom UI example that fetches the atlassian.com website. No changes were made to the static/ section.

// src/index.js
import Resolver from '@forge/resolver';
import api from '@forge/api';

const resolver = new Resolver();

resolver.define('getText', async (req) => {
  const txt = await api.fetch("https://www.atlassian.com").then(res => res.text());
  console.log(txt);

  return txt;
});

export const handler = resolver.getDefinitions();

Thank you JoshuaHwang