OPENAPI
I'm trying to write the openapi-api code to import company data from the VAT number. I can't figure out how to tell which value to put in which field. I don't understand anything about API but I'm trying and I want to learn. In this example I would like to import the "toponimo" from the api result and insert it into the "topo" field in Ninox. What am I doing wrong?
do as server
let url := "https://imprese.openapi.it/advance/" + 'Partita Iva';
let APIKey := "Bearer API-NUMBER";
let response := http("GET", url, {
Authorization: APIKey,
'content-type': "application/json"
}, {
fields: {
topo: data.toponimo
}
end
The result api from where I need to get the data to my fields in Ninox, should give the data like below:
{
"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": "OPEN HOLDING S.R.L.",
"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)
Here the link to the reference-page of the API
5 replies
-
Can someone help me please?
-
Did u try the url with postman? Did you get results?
you can also test the result by adding codeline: alert(text(result))Sorry, I can't test now on my ipad because of vacation trip. Tip: try your question also in the German forum...
-
I've get to the final solution:
let auth := { Authorization: "Bearer TOKEN-NR", 'Content-Type': "application/json", 'API-NUMBER': "API-NR", }; let piva := 'Partita Iva'; let myURL := "https://imprese.openapi.it/advance/" + piva; let response := do as server let response := do as server http("GET", myURL, auth, {}) end; API_Response := text(response); 'Company Name' := text(response.result.data.denominazione); topo := text(response.result.data.toponimo) end; (empty)
Thanks for your help
Content aside
- Status Answered
-
1
Likes
- 1 yr agoLast active
- 5Replies
- 202Views
-
3
Following