Rest API calls fail with 404 and "The property isDevOpsProjects does not exist."

Larry Landry June 8, 2022

I have a very simple Forge app that is calling the Jira Cloud Platform Rest API. Note that I get the same behavior no matter what methods I call. I get a 404 "Not Found" error on all calls. But I am able to make the identical calls from Postman successfully. I've tried both asUser and asApp with the same results. When looking at the network calls I can see that my urls are getting changed to

"<my url>/properties/isDevOpsProjects"

and if I try hitting that with curl it returns the error 

"The property isDevOpsProjects does not exist.".

I've double checked all scopes and permissions and everything seems in order. What could be causing this. My code looks like the following:

import ForgeUI, { render, Text, ProjectPage, useState } from '@forge/ui';
import api, { route } from "@forge/api";

const App = () => {

    const requestUrl = `https://<my-domain>.atlassian.net/rest/api/3/project/STP`;

    const response = useState(async () => await getReponse(requestUrl));

    return (
        <ProjectPage>
        <Text>Hello, world! {JSON.stringify(response)}</Text>
        </ProjectPage>
    );
};

const getReponse = async (url) => {
    const res = await api.asApp().requestJira(route`${url}`,
    {
        headers: { 'Accept': 'application/json' }
    });
    return res.json();
};

export const run = render(
<App />
);

The response is

Hello, world! [{"timestamp":"2022-06-08T17:08:26.469193Z","status":404,"error":"Not Found","message":"No message available","path":"....https:/<my-domain>.atlassian.net/rest/api/3/project/STP"},null]

 

 

1 answer

1 accepted

2 votes
Answer accepted
Larry Landry June 8, 2022

Solved my own problem. 

requestUrl = `https://<my-domain>.atlassian.net/rest/api/3/project/STP`;

should be

requestUrl = `/rest/api/3/project/STP`;

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
PERMISSIONS LEVEL
Site Admin
TAGS
AUG Leaders

Atlassian Community Events