The invokeRemote
bridge method enables apps to integrate with remote backends
hosted outside the Atlassian platform.
To use the invokeRemote
bridge method, you need to define an endpoint
for your back end in the manifest.yml
file.
1 2interface InvokeRemoteInput { path: string; method: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH'; headers?: Record<string, string>; body?: unknown; } function invokeRemote( input: InvokeRemoteInput ): Promise<{ [key: string]: any } | void>;
baseUrl
of the remote.A Promise
that resolves with the data returned from the invoked endpoint:
content-type
header must be application/json
.Promise
will reject if the invoked endpoint returns a non-JSON response.Promise
will reject if the invoked endpoint returns a non-2xx status code.Promise
.headers
properties.Making a POST
request to a remote endpoint:
1 2import { invokeRemote } from "@forge/bridge"; const res = await invokeRemote({ path: `/tasks/`, method: 'POST', headers: { x-header-key: 'x-header-value', }, body: { department: 'Ecosystem', team: 'Forge', description: 'Write docs' } }); console.log(`Created task: ${JSON.stringify(res.task)}`);
Making a GET
request to a remote endpoint:
1 2import { invokeRemote } from "@forge/bridge"; const res = await invokeRemote({ path: `/tasks/?team=Forge`, method: 'GET' }); console.log(`Tasks: ${JSON.stringify(res.body[0])}`);
Rate this page: