0

Response in JSON Format alternately functioning

Ok. I finally achieved my goal to get informations from a site and used to fill my fields in Ninox

for Example The formula request for the formula field called

Artist name:

let xDiscogsRelease := Numero;
let url := "https://api.discogs.com/releases/" + xDiscogsRelease;
let token := "xxxxx";
let response := http("GET", url, {
        Authorization: "Bearer " + token,
        'Content-Type': "application/json"
    });
let Artist_Name := item(response.result.artists, 0).name;
Artist_Name

Country:

let xDiscogsRelease := Numero;
let url := "https://api.discogs.com/releases/" + xDiscogsRelease;
let token := "xxxxx";
let response := http("GET", url, {
        Authorization: "Bearer " + token,
        'Content-Type': "application/json"
    });
let country := response.result.country;
country

and so on

 the json format field 

let xDiscogsRelease := Numero;
let url := "https://api.discogs.com/releases/" + xDiscogsRelease;
let token := "xxxxx";
let response := http("GET", url, {
        Authorization: "Bearer " + token,
        'Content-Type': "application/json"
    });
response

indicates that the request is accepted and everything is OK

But as I change the Numeric Field called "Numero" to get informations about another album

 i got an error from the response. 

{"error":"Request has failed: error - "}

but if I wait some seconds and touch the Administration button:

 everything see to works well:

 

 Has anyone of you met this strange behaviour? Is this connected to a maximum limit of responses which can be get in time limit?

Thank you for you attention 

2 replies

null
    • Ninox partner
    • RoSoft_Steven.1
    • 1 yr ago
    • Reported - view

    Maybe it's better to use static fields for those requests instead of using a formula field because all the formula fields are executed at the same time in your table and that might be an issue.

    Also the API call wrapping in a do as server would maybe help:

    let responce := do as server http("GET", url, {
            Authorization: "Bearer " + token,
            'Content-Type': "application/json"
        }) end;

    Hope this helps.

      • francescostefanello
      • 1 yr ago
      • Reported - view

       this API doesn't work, I will try to understand why in these days.

Content aside

  • 1 yr agoLast active
  • 2Replies
  • 94Views
  • 2 Following