Cannot display record from server via fetch API in Forge

Please I need Urgent help. Am trying to display a searched fullname from Server via Fetch API in Forge but it does not show any result.

Please can someone help me out with the fetch API Forge Code below

This is my coding so far.

import api, { route } from "@forge/api";
import ForgeUI, { render, Fragment, Text, IssuePanel, useProductContext, useState, Component} from "@forge/ui";
import { fetch } from '@forge/api';

const App = () => {	 

 const searchFullname={
    username: 'rahul',
id: '101'

const payload ={
	// These properties are part of the Fetch Standard
	method: 'GET',
	headers: {'Content-Type': 'application/x-www-form-urlencoded'},   
	body: searchFullname
const result = await api.fetch("https://mysitecom/record.php/, payload");
const status = await result.status;

// display my searched Data from server

  return (

      <Text>Display Searched Fullname from Server</Text>

export const run = render(
    <App />

Hi @EsedoFredrick,

Can you please be a bit more specific with the issue you are facing? Do you have a stack trace? Are you running Forge tunnel?

Looking at your code, there are quite a few issues:

You can’t use await inside of a function that does not have async declared. Forge components cannot be async, so you’ll need to use a hook.


It may be worth following the getting started tutorial to see how fetch requests work in Forge:

Your fetch syntax has an error in it too:

api.fetch("https://mysitecom/record.php/, payload"); should be api.fetch("https://mysitecom/record.php/", payload);

1 Like

Thanks for getting back to me @danielwinterw am running Forge UI Kit for Jira Issue. Please can you help me restructure the code to the best way possible so that i can test it from my own end. Am following this tutorials.


Hi @EsedoFredrick,

That’s a little difficult for me to do without understanding what you are trying to accomplish.

I’d recommend following the tutorials and then asking specific questions when you find a problem. Try to include things like stack traces and/or screenshots to help us get you an answer :slight_smile: