eureka2 / G6K

Generator of calculation simulator (calculator)
MIT License
20 stars 19 forks source link

400 errors with no details in G6K API mode #47

Open eloi-juszczak opened 3 years ago

eloi-juszczak commented 3 years ago

Hello,

I'm trying to use the G6K simulator as an API, therefore i made the changes inside the g6k.yml file, I imported the simulator definitions files (for the French "simulateur de cout de carte grise") and so on.

when I try the simulator in the graphical interface at this url {{base_url}}/cout-certificat-immatriculation, it works perfectly fine.

However, when it comes to use the API, I have some errors. I configured the g6k.yml file like this : api: cout-certificat-immatriculation: step: 0 action: calculer according to the "data" tab of this url : {{base_url}}/admin/simulators/cout-certificat-immatriculation which I think it is good. (the simulator has 2 steps : step 0 with the button action 'calculer' and the step 1 with the action buttons 'retour' and 'nouveau calcul') I tried the api with differents request parameters such as : {{base_url}}/cout-certificat-immatriculation/api?IsCamionnette5Places=2&dateMiseEnCirculation=30%2F12%2F2016&declareVehiculeDemonstration=2&demarche=2&departement=02&energie=ESSENCE&invalidite=2&modificationEnergiePropre=2&puissanceAdministrative=11&receptionCommunautaire=2&step=0&tauxCO2=170&typeVehicule=1

but the response returns a 400 error with no details ("errors":[]) and in the symfony profiler I can see it is a 400 code error.

When I try with less request parameters, such as :

{{base_url}}/cout-certificat-immatriculation/api?IsCamionnette5Places=2&Vehicule_N1_Transport_voyageurs=Non&dateMiseEnCirculation=30%2F12%2F2016&declareVehiculeDemonstration=2&demarche=2&departement=02&energie=ESSENCE&invalidite=2&puissanceAdministrative=11&receptionCommunautaire=2&step=0&tauxCO2=170&typeVehicule=1

The response return a bad result.

I don't understand what is wrong and how could I get a more explicit 400 error ? Do you know what I could have misconfigured ? I have the feeling the inside g6k.yml I should not have put step: 0, because it seems like if a step is missing when I get some results, (even if it corresponds to what I can see in the simulator definition graphical interface).

Thanks in advance !

ShoweRocket commented 1 year ago

Bonjour @eloi-juszczak,

J'essaie également d'intégrer le simulateur sur un site externe via l'API mais sans succès, j'aimerai savoir si vous aviez fini par réussir, et si vous pouviez m'aider dans ma démarche ?

D'avance merci