Uniface User Forum

 View Only
  • 1.  Uniface API (DSP) does not receive Json parameters when called with GET

    Posted 01-26-2024 09:42

    Hi

    We are writing our first REST Api with Uniface 9.7.04.

    In the DSP, we extract the input parameters with $webinfo("input").

    When calling our API with a test tool (postman, SoapUI, etc)  with PUT with Json data, the input parameters are received.

    But when calling the same API with the same tool and the same parameters but with GET, the input parameters are always empty.

    Is it normal to not receive the json input data when called with GET?

    How can we get them ?

    Thanks,

    Regards



    ------------------------------
    Nicolas Colmart
    Self Registered
    Nice FR
    ------------------------------


  • 2.  RE: Uniface API (DSP) does not receive Json parameters when called with GET

    PARTNER
    Posted 01-26-2024 10:12

    I'm not sure I understand. Do you want to get json data, or to send it to your API ?

    With a GET command, you can pass parameters in your URL (something like https://www.yourapi.com/api/v1/user/12 or https://www.yourapi.com/api/v1/user?id=12  ) and then recieve json (or any format you need).

    But if you want to send a payload in json, you should use POST (or PUT). POST is (supposed to be) used for creation and PUT for updates.

    More infos on https://restfulapi.net/http-methods/



    ------------------------------
    Jean-Marc SALIS
    Mp Services
    Montauban Cedex FR
    ------------------------------



  • 3.  RE: Uniface API (DSP) does not receive Json parameters when called with GET

    Posted 01-29-2024 04:20

    Hi Jean Marc

    Thanks for your answer

    Our API must return json data from a GET request.
    The request must have some parameters in order to filter the data returned.

    We thought it could be possible to receive the input parameters in Json format.
    But as I can see, the only way to have input parameters for a GET request is from the URL itself.

    Regards,



    ------------------------------
    Nicolas Colmart
    Self Registered
    Nice FR
    ------------------------------



  • 4.  RE: Uniface API (DSP) does not receive Json parameters when called with GET

    PARTNER
    Posted 01-26-2024 10:17

    Hi Nicolas,

    Why are you using a DSP to create REST API ?  Use an USP.

    We have no problem with USP whatever the http word used.

    Gilles.

     



    ------------------------------
    Hortion Gilles
    Dedalus Healthcare France
    Artigues Pres Bordeaux FR
    ------------------------------



  • 5.  RE: Uniface API (DSP) does not receive Json parameters when called with GET

    Posted 01-29-2024 04:28

    Hi Gilles

    Thanks for your advice
    I'll try asap

    Regards



    ------------------------------
    Nicolas Colmart
    Self Registered
    Nice FR
    ------------------------------