0

Select result if more then one - Rest API

Hi,

I have an API-Code in Ninox

let auth := {
        Authorization: "Bearer TOKENNR",
        'Content-Type': "application/json"
    };
let Paiva := 'Inserisci p.iva (solo nr) o cod.fisc.';
let myURL := "https://imprese.openapi.it/advance/" + Paiva;
let response := do as server
        let response := do as server
                http("GET", myURL, auth, {})
            end;
        'Partita IVA / C.F.' := text(response.result.data.piva);
        'Cod. fiscale' := text(response.result.data.cf);
        'Ragione Sociale' := text(response.result.data.denominazione);
        'Indirizzo, Città, Cap' := text(response.result.data.indirizzo) + ", " + text(response.result.data.cap) + " " +
            text(response.result.data.comune) +
            " (" +
            text(response.result.data.provincia) +
            ")";
        'Posizione CCIAA' := text(response.result.data.dettaglio.cciaa);
        'E-mail (PEC)' := text(response.result.data.dettaglio.pec);
        'Rappresentante Legale' := text(response.result.data.detttaglio.denominazione);
        API_Response := text(response);
        'Inserisci p.iva (solo nr) o cod.fisc.' := null;
    end;

 

Copy

 

and get to this result: 

{
  "data": {
    "cf": "12485671007",
    "denominazione": "OPENAPI S.R.L.",
    "piva": "12485671007",
    "toponimo": "VIALE",
    "via": "F TOMMASO MARINETTI",
    "civico": "221",
    "indirizzo": "VIALE F TOMMASO MARINETTI 221",
    "comune": "ROMA",
    "frazione": null,
    "provincia": "RM",
    "stato_attivita": "ATTIVA",
    "timestamp": 1622452306,
    "timestamp_creation": 1622452306,
    "timestamp_last_update": 1622452306,
    "dettaglio": {
      "rea": "1378273",
      "cciaa": "RM",
      "pec": "openapi@legalmail.it",
      "codice_natura_giuridica": "SR",
      "descrizione_ateco": "Produzione di software non connesso all'edizione",
      "codice_ateco": "6201",
      "data_inizio_attivita": "2013-10-20",
      "bilanci": {
        "2017": {
          "data_chiusura_bilancio": "2017-12-31",
          "fatturato": 1120176,
          "utile": 2928
        },
        "2018": {
          "data_chiusura_bilancio": "2018-12-31",
          "fatturato": 1325358,
          "utile": 826
        },
        "2019": {
          "data_chiusura_bilancio": "2019-12-31",
          "fatturato": 1799587,
          "utile": 11309,
          "dipendenti": 14,
          "capitale_sociale": 10000
        }
      },
      "gruppo_iva": {
        "partecipazione": false,
        "piva_capogruppo": false,
        "anagrafica_ok": true
      },
      "cessata": false,
      "soci": [
        {
 *       "denominazione": "TEST1.",
         "nome": null,
         "cognome": null,
         "cf_socio": "16935371001",
          "quota": 100
        }
      ]
    },
    "cap": "00143",
    "codice_destinatario": "MJ1OYNU",
    "id": "60b4f9c914e27c27d12a9d67",
    "gps": {
      "coordinates": [
        12.47843,
        41.8071
      ]
    },
    "data_iscrizione": "2013-07-19"
  },
  "success": true,
  "message": "",
  "error": null
} (empty) (empty)

 

Copy

 

How can I get the result from response.result.data.detttaglio.denominazione in my field on Ninox named "Rappresentante legale"? It's the only one that doesn't work.  Also it can be more than one result in "soci". How I have to write the formula in that situation?

1 reply

null
    • Ninox partner
    • RoSoft_Steven.1
    • 11 mths ago
    • Reported - view

    denominazione is in the soci group in your example .json, so I think you need to put this in the code:

    'Rappresentante Legale' := text(response.result.data.detttaglio.soci.denominazione);

Content aside

  • 11 mths agoLast active
  • 1Replies
  • 72Views
  • 2 Following