Context: Hey, so I am a non-coder trying to connect to an API, run an automation and export the results to a JSON file. I have figured it all out, but struggling with the test script part. My automation succeeds and has all the details I need in the response body, but when exporting the file, there are blanks instead of responses. I have added text (“array of all properties”) to the test script and saw it worked when exporting.
My question: Now I need to find a way to export the full body of the API output in the test (or similar so that it is included in the JSON export).
Details (like screenshots):
{
"results": [
{
"siren": "XXXXXXXXX",
"nom_complet": "XXX",
"nombre_etablissements": 1,
"nombre_etablissements_ouverts": 1,
"siege": {
"activite_principale": "XXXXX",
"activite_principale_registre_metier": "XXXXXX",
"adresse": "XXXXX",
"cedex": null,
"code_pays_etranger": null,
"code_postal": "XXXXX",
"commune": "XXXXX",
"complement_adresse": null,
"coordonnees": "XXXXX",
"date_creation": "XXXXXX",
"date_debut_activite": "XXXXXX",
"departement": "XXX",
"distribution_speciale": XXX,
"est_siege": true,
"etat_administratif": "A",
"geo_adresse": "XXXXX",
"geo_id": "XXXXX",
"indice_repetition": null,
"latitude": "XXXXX",
"libelle_cedex": null,
"libelle_commune": "XXXXX",
"libelle_commune_etranger": null,
"libelle_pays_etranger": null,
"libelle_voie": "XXXXX",
"liste_enseignes": null,
"liste_finess": null,
"liste_idcc": null,
"liste_rge": null,
"liste_uai": null,
"longitude": "XXXX",
"nom_commercial": null,
"numero_voie": "11",
"siret": "XXXXX",
"tranche_effectif_salarie": null,
"type_voie": "XXXXX"
},
"activite_principale": "XXXXX",
"categorie_entreprise": "XXXXX",
"date_creation": "XXXX",
"date_mise_a_jour": "XXXXXX",
"dirigeants": [
{
"nom": "XXXX",
"prenoms": "XXXXX",
"annee_de_naissance": "XXXXX",
"qualite": "XXXXX",
"type_dirigeant": "XXXX"
}
],
"etat_administratif": "XXX",
"nature_juridique": "XXX",
"nom_raison_sociale": "XXXX",
"section_activite_principale": "XXXX",
"tranche_effectif_salarie": XXXX,
"matching_etablissements": [],
"complements": {
"collectivite_territoriale": null,
"convention_collective_renseignee": false,
"est_entrepreneur_individuel": false,
"est_entrepreneur_spectacle": false,
"est_ess": false,
"est_finess": false,
"est_rge": false,
"est_uai": false,
"identifiant_association": null
}
}
],
"total_results": 1,
"page": 1,
"per_page": 10,
"total_pages": 1
}
I’ve already tried: The “array of all properties” here and tried to manipulate it to work with my use case but it did not.
I don’t need all the fields, but for now I am just looking for a command to add to test that will be able to post the entire result there. Later on, I can narrow it down by variable. The variables I will need eventually are:
- nom_raison_sociale
- siege.adresse
- siege.libelle_commune
- siege.code_postal
- dirigeants.nom & dirigeants.prenom
- annee_de_naissance (just the year)
- activite_principale
- siren
- etat_administratif
- siret
Appreciate any advice on the topic.