Pass value of Gravity Forms form through API mid-form (gform_post_paging hook)

Job ID: 32309853

Budget: €18 – €36 EUR

The content of a specific Gravity Forms form field (string) is to be passed through a REST API (POST method) upon going to the next page of the (multi-page) form (e.g. via the gform_post_paging webhook, cf. https://docs.gravityforms.com/gform_post_paging/ ). The respective values of specific keys of the JSON response body must then each be inserted into other fields of the same Gravity Forms form (which will appear after pagination). For the details, see below (item (1)).

The Gravity Forms target fields are currently designed as user-editable fields. For the final live design, we would want to insert the respective strings as "merge" tags inside of HTML fields instead (alternatively, the target form fields could be made read-only).

For a follow-up job (not included in this commission), the input (value) from the Gravity Forms fields mentioned above would have to be passed through _two_ APIs. For the details, see below (item (2)). While, again, this extended design is not part of this commission, anybody offering their services should also be able to prepare the extension swiftly.

Please see below for _redacted_ ("XXX...") mentions of the API URLs in question. The full and valid URLs will be provided after commissioning. Wordpress, FTP and DB credentials will also be provided immediately after commissioning.

Kindly also have a look at the (related) Gravity Forms- and Gravity Perks-specific work that we are about to put out to tender separately shortly.

Details:

#Gravity Forms form in question:

https://XXXX.XXX/wp-admin/admin.php?page=gf_edit_forms&id=23
form_ID: 23

#"Origin" field":

companyNameCurrent
field_ID: 5
(already retrieved via Ajax through custom WordPress extension, which in turn calls [another] GET API [ https://www.XXX.XXX/XXX/api/v1/autocomplete.json?prefix=$ajaxInput&deletedFirms=true&formerNames=true ])

#(1) Envisaged transformation as being object of this commission:

#(a) legalSeatCurrent:

companyNameCurrent (Gravity Forms form_ID: 23, field_ID: 5) → gf_post_paging → API 1 (POST) → legalSeatCurrent (form_ID: 23, field_ID: 6):
1. On Gravity Forms hook gf_post_paging, take value (string) of companyNameCurrent (field_ID: 5);
2. Pass on as $.name to POST API (see below);
3. Extract $.[0].legalSeat (string) from API response body;
4. Save as value for field legalSeatCurrent (field_ID: 6) for current entry.

#(b) legalFormCurrent:

companyNameCurrent (Gravity Forms form_ID: 23, field_ID: 5) → gf_post_paging → API 1 (POST) → legalFormCurrent (form_ID: 23, field_ID: 6):
1. On Gravity Forms hook gf_post_paging, take value (string) of companyNameCurrent (field_ID: 5);
2. Pass on as $.name to POST API (see below);
3. Extract $.[0].legalForm.name.de (string) from API response body;
4. Save as value for field legalFormCurrent (field_ID: 82) for current entry.

#(2) [Additional commission (may as well be added as a milestone)] - cantonCurrent:

companyNameCurrent (field_ID: 5) → API 1 (POST) → API 2 (GET) → cantonCurrent (field_ID: 83):
1) Take value (string) of companyNameCurrent (field_ID: 5)
2) Pass on as $.name to POST API (see below)
3) Extract $.[0].uid (string) from API response body
4) Pass on to (GET) API #2 (see below)
5) Extract $.[0].canton (string) from API response body
6) Save as value for field cantonCurrent (field_ID: 83) for current entry

#API 1 (POST):

curl --request POST \
--url https://www.XXXXXX.XXX/XXX/XXX/company/search \
--header 'Authorization: Basic XXXXXXXXXXXXXXXX=' \
--header 'Content-Type: application/json' \
--header 'accept: application/json' \
--cookie cookiesession1=XXXXXXXXXXXXXXXX \
--data '{
"name": "$companyNameCurrent"
}'

#API 2 (GET):

curl --request GET \
--url https://www.XXXXXX.XXX/XXX/XXX/company/uid/$.[0].uid \
--header 'Authorization: Basic XXXXXXXXXXXXXXXX=' \
--header 'accept: application/json' \
--cookie cookiesession1=XXXXXXXXXXXXXXXX
Related categories: PHP WordPress JSON