Forums

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

Fill a Form by API

Mateusz Olech
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
February 21, 2024

Hi, 
I want do migration all 500 tasks with API, I must fill up the all fields in my form, I got the return

400 b'{"errorMessages":["Invalid request payload. Refer to the REST API documentation and try again."]}'

My payload looks like this: 

payload = {
        "form": {
            "answers": {
                "1": {"text": description},
                "2": {"text": summary},
            }
        },
        "isAdfRequest": False,
        "requestFieldValues":
        {
            "customfield_10002": [int(mapping(dict_of_projects,project_name))], # organizacja
        },
        "fields": {
            "Numer telefonu": str(phone(bug_id)), # Numer Telefonu
            "Osoba Zgłaszająca": str(name_surname(bug_id)),  
            "Mantysa URL": str(create_a_mantis_link(bug_id)),
            "Adres email": str(find_mail(bug_id)),
        },
        "requestParticipants": [],
        "requestTypeId": "33",  
        "serviceDeskId": "2",

    }

Also I try like this:
 "fields": {
            "customfield_10298": str(phone(bug_id)),
            "customfield_10299": str(name_surname(bug_id)),  
            "customfield_10224": str(create_a_mantis_link(bug_id)),
            "customfield_10297": str(find_mail(bug_id)),
        },

I would like to use Python to do a API, I can't find in Documentation answer to my question. What I do wrong?

1 answer

1 vote
Nikola Perisic
Community Champion
February 21, 2024
Mateusz Olech
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
February 21, 2024

Yes, I got a response : 
{
"design": {
"conditions": {},
"layout": [
{
"content": [
{
"attrs": {
"extensionKey": "question",
"extensionType": "com.thinktilt.proforma",
"layout": "default",
"localId": "7214d2e9-3034-4074-af24-99225ede1394",
"parameters": {
"id": 1
}
},
"type": "extension"
},
{
"attrs": {
"extensionKey": "question",
"extensionType": "com.thinktilt.proforma",
"layout": "default",
"localId": "a331ddf9-a490-4712-aa7a-68890c6a3aad",
"parameters": {
"id": 9
}
},
"type": "extension"
},
{
"attrs": {
"extensionKey": "question",
"extensionType": "com.thinktilt.proforma",
"layout": "default",
"localId": "6525edfc-3882-40cb-b9ca-36b4eb95fb2f",
"parameters": {
"id": 2
}
},
"type": "extension"
},
{
"attrs": {
"extensionKey": "question",
"extensionType": "com.thinktilt.proforma",
"layout": "default",
"localId": "8f4a4cf1-6f5f-49bb-96c3-95ce0d9c8db6",
"parameters": {
"id": 3
}
},
"type": "extension"
},
{
"attrs": {
"extensionKey": "question",
"extensionType": "com.thinktilt.proforma",
"layout": "default",
"localId": "e95a57b0-8026-4a19-8e9b-851984277a64",
"parameters": {
"id": 7
}
},
"type": "extension"
},
{
"attrs": {
"extensionKey": "question",
"extensionType": "com.thinktilt.proforma",
"layout": "default",
"localId": "b7f90e9c-e1ea-4627-895a-10c6c367577e",
"parameters": {
"id": 4
}
},
"type": "extension"
},
{
"attrs": {
"extensionKey": "question",
"extensionType": "com.thinktilt.proforma",
"layout": "default",
"localId": "ac9f7715-e421-41c9-bd95-f1e8b626b7a2",
"parameters": {
"id": 10
}
},
"type": "extension"
}
],
"type": "doc",
"version": 1
}
],
"questions": {
"1": {
"defaultAnswer": {
"choices": [
"3"
]
},
"description": "",
"jiraField": "priority",
"label": "Piorytet",
"questionKey": "",
"type": "cd",
"validation": {
"rq": true
}
},
"10": {
"description": "",
"jiraField": "customfield_10055",
"label": "Link do Mantysy ~ Migracja",
"questionKey": "mantis_url",
"type": "tu",
"validation": {
"rq": false
}
},
"2": {
"choices": [],
"description": "",
"label": "Opis",
"questionKey": "Opis",
"type": "tl",
"validation": {
"rq": true
}
},
"3": {
"description": "",
"jiraField": "customfield_10297",
"label": "E-mail",
"questionKey": "mail",
"type": "te",
"validation": {
"rq": true
}
},
"4": {
"description": "",
"jiraField": "customfield_10298",
"label": "Numer telefonu",
"questionKey": "telefon",
"type": "tl",
"validation": {
"rq": true
}
},
"7": {
"description": "",
"jiraField": "customfield_10299",
"label": "Osoba zg\u0142aszaj\u0105ca",
"questionKey": "osoba_zglaszaj\u0105ca",
"type": "tl",
"validation": {
"rq": true
}
},
"9": {
"description": "",
"jiraField": "summary",
"label": "Podsumowanie",
"questionKey": "Podsumowanie",
"type": "tl",
"validation": {
"rq": true
}
}
},
"sections": {},
"settings": {
"name": "Formularz zg\u0142oszeniowy",
"submit": {
"lock": false,
"pdf": false
}
}
},
"id": "d498f981-d812-459c-8585-d01790ddbdba",
"publish": {
"jira": {
"issueCreateIssueTypeIds": [],
"issueCreateRequestTypeIds": [
33
],
"recommendedIssueRequestTypeIds": [],
"submitOnCreate": true,
"validateOnCreate": true
},
"portal": {
"portalRequestTypeIds": [
33
],
"submitOnCreate": true,
"validateOnCreate": true
}
},
"updated": "2024-02-21T09:45:23.724Z"
}
PS C:\Users\mati>

Suggest an answer

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

Atlassian Community Events