Forum Discussion

madhavi_l's avatar
madhavi_l
New Contributor
4 years ago

Rest - Parameter empty value

Hi,

 

I want to send a parameter with empty value in the rest request itself in soap-ui. I tried cloning my one of the existing resources and made the parameter required too.But still I'm not able to send the parameter with empty value.Can you please help me on this to solve my problem? 

 

My request would be something similar to this and I'm specifying the type parameter with an empty value.

GET http://localhost/service?type=

 

Thank you in advance !

3 Replies

  • richie's avatar
    richie
    Community Hero
    Hey Madhavi_1,

    Can you provide some screenshots of your REST request setup please?

    Reason i ask to see what youve currently got setup is that ive submitted blank REST parameters loads of times before now when ive made a mistake and unintentionally submitted a blank rather than the intended value!

    Cheers,

    Rich
      • richie's avatar
        richie
        Community Hero

        Hey madhavi_l 

         

        oh! the last parameter? Right sorry - I didnt realise

         

        Im using ReadyAPI! and it appears that if you dont include a value on the last query parm - the whole parm itself is removed - which is the same behaviour in SoapUI I'm assuming?

         

        Yeah- that's no problem - just change the order of the parameters so any parameter you want to submit a blank/no value on isn't the last parameter - then it'll work fine.

         

        The rules around query parms in REST is pretty clear - you can submit them in any order you wish

         

        So - using your example URL

         

        https://<server>/<Service>?patient=123&_query=DocumentType&DocumentTypeIds=

         

        here above - 'patient' and 'query' can be submitted with blanks/no value, but DocumentTypeIds cant be blank

         

        If you want to submit blank DocumentTypeIds - just alter the sequence of parms so the one you want blank IS NOT the last parm in the sequence, so it reads like the following:

         

        https://<server>/<Service>?patient=123&DocumentTypeIds=&_query=DocumentType

         

        Clear?

         

        Cheers,

         

        rich