Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

How to fetch/request the field types and options for Proforma forms?

Victor Mariano Leite
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!
November 27, 2024

Context:

I've been developing a SDK to interact with Proforma fields, because it would ease a lot of the work in the CI/CD pipelines of our company, but the endpoint to fetch these values are not documented, or at least the documentation is very obscure and hidden.

At first I had a method in my SDK that used to fetch the options of each form field like this:

    def _fetch_proforma_options(self, portal_id: int, request_type_id: int) -> Dict:
        """
        Fetches additional options for Proforma fields using a separate API endpoint.

        Parameters
        ----------
        portal_id : int
            The ID of the service desk project (portalId).
        request_type_id : int
            The ID of the request type.

        Returns
        -------
        Dict
            A dictionary containing the additional Proforma field options.
        """
        try:
            headers = self.all_headers
            tenant_info_url = f"{self.base_url}/_edge/tenant_info"
            tenant_info_response = requests.get(tenant_info_url, headers=headers)
            tenant_info_response.raise_for_status()
            cloud_id = tenant_info_response.json()["cloudId"]

            form_choices_url = f"{self.base_url}/gateway/api/proforma/portal/cloudid/{cloud_id}/api/3/portal/{portal_id}/requesttype/{request_type_id}/formchoices"
            form_choices_response = requests.get(form_choices_url, headers=headers)
            form_choices_response.raise_for_status()
        except requests.exceptions.HTTPError as e:
            return {}
        return form_choices_response.json()

Reverse Engineering the request:

But it seems that this data has changed the source, and the authentication strategy, when reverse engineering the request structure, I found that the new endpoint is the following:

Field Data:

https://{COMPANY_ATLASSIAN_URL}/gateway/api/proforma/portal/cloudid/{CLOUD_ID}/api/cloud/portal/{PORTAL_ID}/requesttype/{REQUEST_TYPE_ID}/form/2/fielddata


And

https://{COMPANY_ATLASSIAN_URL}/rest/servicedesk/1/customer/models


in the response path reqCreate.proformaTemplateForm.design.questions, there are the field names, jira issues linked, descriptions.

Form Choices:

https://{COMPANY_ATLASSIAN_URL}/gateway/api/proforma/portal/cloudid/{CLOUD_ID}/api/3/portal/{PORTAL_ID}/requesttype/{REQUEST_TYPE_ID}/formchoices


But I wanted to be updated about these changes in the API Endpoint, because I don't even know the authentication strategy now with the new API, the old one is not working any more.

It would be interesting to have these informations centralized somehow.

 

To sum it up, I want to know:


What's the best way to fetch these informations, which endpoint? What's the authentication strategy for each? Which headers there must be in the request, how to fetch these values? And how to be updated with these changes, are there any documentation explaining these?

0 answers

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
TAGS
AUG Leaders

Atlassian Community Events