Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

"Specify a valid project ID or key" exception while creating an issue from Google Script

Zet
October 19, 2023
I'm trying to create an issue in my Jira (Cloud) project with URL Fetch in Google Script.
The main code is:

    issue = {
        "fields": {
          "issuetype": "Task",
          "summary": "Summary",
          "reporter": {"displayName": "John"},
          "priority": "Medium",
          "project": {"key": projectKey}
        }
      };
    UrlFetchApp.fetch(jiraUrl, {
      method: "POST",
      headers: {
        'Content-Type': "application/json",
        "Authorization": "Basic " + Utilities.base64Encode(userName + ':' + apiToken)
      },
      payload: JSON.stringify(issue)
    });

When I run it, I get a 400 exception: Truncated server response: {"errorMessages":[],"errors":{"project":"Specify a valid project ID or key"}}
However, I'm pretty sure that I put the correct key (shows in the issue datas I got from my Jira project in the same URL Fetch way) of my project into the line ("project": {"key": projectKey})
And I also tried using "project": {"id": projectId}, but still the same exception.
I have found similar questions and reports about this exception on the Internet. But it seems no effective solution mentioned ever.

1 answer

1 accepted

3 votes
Answer accepted
JP _AC Bielefeld Leader_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Champions.
October 25, 2018

What is the language setting of the logged in user / admin in his profile?

Nic Brough -Adaptavist-
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Champions.
October 25, 2018

I think there's plenty of clear answers.  Change it back in the general settings.

Jan-Peter is rightly pointing out that if you have ever chosen a different language in your profile, you will not be using the default language any more, you will always use your currently selected one.  So changing the default will not change your display.

Abdel
October 25, 2018

Thanks guys for your replies.


It is french.

Knowing that I've reinstalled the software in English, but it automatically set back to French after importing the previous database.

 

Selection_010_25_10.jpg

Nic Brough -Adaptavist-
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Champions.
October 25, 2018

The language settings are in the database.  So when you import the old data, you get that setting back.

The language the software is installed in is not relevant, all it does is set the default value in a new database.

Abdel
October 25, 2018

Ok, so if I understood well, whatever the language of the installation, you'll get the language of the imported database and no way to switch to English?

---
If it was able to switch the language to the one of the imported database, why not make it a feature to switch between languages?

I am trying to make a case for a feature request.

Nic Brough -Adaptavist-
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Champions.
October 25, 2018

Yes, because the language setting is in the database.

After you import from an old database, all you have to do is change the default again.  I don't think there's much case for a feature here - you import, spot the language is wrong, change it.  Setup checks and updates are a natural part of any migration or merge.  If you put in a flag to ask what language to change on import, there's another 5,000 settings I would want to ask about...

Abdel
October 25, 2018

Sorry to restate the question again Nic,

In my case (knowing my parameters above), is it possible to switch the interface language to English?

Nic Brough -Adaptavist-
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Champions.
October 25, 2018

Again, change it back in the general settings.  Assuming you mean the global selection.  For your selection, do it in your profile.

JP _AC Bielefeld Leader_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Champions.
October 25, 2018

It's not that difficult:

1. Click on your profile picture & select "Profile" (First menu item)

You'll get something like this:

p1.JPG2. Click the "Edit" icon to the right & you'll get:

p2.JPG

3. Select you language & DON'T forget to click "Update" at the bottom.

4. Reload the page & voila: All set to the language you like

Abdel
October 25, 2018

Thanks @Nic Brough -Adaptavist- &@JP _AC Bielefeld Leader_,

@JP _AC Bielefeld Leader_ , your answer can't be anymore clear!! Appreciate it.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events