eureka2 / G6K

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

API step issue #38

Closed Dexter0015 closed 3 years ago

Dexter0015 commented 3 years ago

Hi, me again,

I want to request the simulator API.

In my G6k package yml config file, I added the following lines:

# api configuration
    api:
        cout-certificat-immatriculation:
            step: 3
            action: calculer

In my previous installation (symfony 2 version), I have it running using the setp 3, that's why I used the step 3 here again.

I used postman to test the api, but get the following error:

{
    "links": {
        "self": "https://<my-api-url>/cout-certificat-immatriculation/api?dateMiseEnCirculation=YYYY-MM-DD&demarche=N&departement=NN&energie=N&puissanceAdministrative=N&step=3&tauxCO2=NNN&typeVehicule=N"
    },
    "errors": [
        {
            "status": "422",
            "title": "Unprocessable entity",
            "detail": "Argument 3 passed to App\\G6K\\Controller\\APIController::apiOutput() must be an instance of App\\G6K\\Model\\Step, null given, called in /path/to/sources/src/G6K/Controller/APIController.php on line 147",
            "source": {
                "pointer": "/data/"
            }
        }
    ]
}

Datas has been aninomyzed so you can see the parameters name in case there have changed (N = 1 number).

Any idea what's wrong?

eureka2 commented 3 years ago
# api configuration
    api:
        cout-certificat-immatriculation:
            step: 3
            action: calculer

Are you sure that there are three steps in your simulator and that this step contains a calculerbutton ?

Dexter0015 commented 3 years ago

You're right, turn out for this version the correct step is 0 (3 was on the symfony 2 version).

The 'calculer' button was correct though (1/2 :) ).

Thanks.