API example request not working and error not beeing logged

Hi, I would like to use an API request to create a new project category. I have created a minimal example on github. I copied the forge example from the forge reference and put it into an async function. I want the app to execute when I click on a button on an admin page. However, since that did not work, for this example I want it to run before the return of the App. So the whole index file looks like this.

const App = () => {
  return (
      <Text>Hello world!</Text>

export const run = render(
    <App />

async function myFunc() {
  var bodyData = `{
    "name": "CREATED",
    "description": "Created Project Category"

  const response = await api
    .requestJira(route`/rest/api/3/projectCategory`, {
      method: "POST",
      headers: {
        Accept: "application/json",
        "Content-Type": "application/json",
      body: bodyData,

  console.log(`Response: ${response.status} ${response.statusText}`);
  console.log(await response.json());

When I start the tunnel and reload the page I get a console output “requesting…” as per myFunc, however, nothing comes after that, not even any type of error. Of course, I have granted the manage:jira-project permission scope. I had tried to catch errors as well but that did not make a difference. I am new to forge and react in general so some help in debugging this would be greatly appreciated!

Hi @MichaelIlewicz,

Please check useAction docs. That hook is something you have to wrap your function with (also keep in mind that the function must return some value). I also recommend you reading the hooks docs to get familiar with other useful ones.

The example below does something similar you want to achieve:
You may find even more examples on https://developer.atlassian.com/platform/forge/example-apps/


@vpetrychuk thanks a lot! I got it now. Now I am facing a 403 forbidden response which I am unsure about where it is coming from… my Manifest looks like this:

    - key: test-api-hello-world-admin-page
      function: main
      title: test-api
    - key: main
      handler: index.run
  id: ari:cloud:ecosystem::app/28d8ffa6-6f53-430a-953b-d28c407fc299
    - manage:jira-project

I thought that is the only scope that the createProjectCategory requires? Or is there anything else I need to watch out for?

As per documentation, the read:jira-work OAuth scopes is required (see OAuth scopes required section). This and other scopes are listed here.


Thanks but is it possible you are looking at the requirements for the “Get all project categories” request? As far as I can see, the “create project category” request does not require that scope. In any case, I have added the scope and it still did not work.

I noticed that calling the api asUser() rather than asApp() will not return the 403 error and succesfully create the project Category… Any idea why?

Hi @MichaelIlewicz,

If you don’t have this error with a brand new project, this might be related to the project settings.


Hi @vpetrychuk, unfortunately, I already am on a brand new project using the default configuration and contains only this one API call