Four Js Development Tools Forum

Discussions by product => Genero BDL => Topic started by: Benjamin G. on October 17, 2024, 11:53:42 am



Title: RESTFull and WSAttachment
Post by: Benjamin G. on October 17, 2024, 11:53:42 am
Hello,

When using WSAttachement to send a file to a GET request, how do I specify that the file is optional?
If I specify an existing file everything works fine. If I don't give a file (ficdia = NULL) it generates an infinite loop with code -8 (http error ...)


this is how the service is defined ...

PUBLIC FUNCTION getDownloadCustomerDiapo(head_numpro STRING ATTRIBUTES(WSHeader,WSOptional,WSName = ‘X-NUMPRODIS’)
                                        ,head_numcli STRING ATTRIBUTES(WSHeader,WSOptional,WSName = ‘X-NUMCLI’)
                                        ,head_diacli STRING ATTRIBUTES(WSHeader,WSOptional,WSName = ‘X-DIACLI’))
         ATTRIBUTES(WSGet
                   ,WSPath = ‘/download-customer-diapo’
                   ,WSDescription = ‘GET : Retrieves the zip file with the customer's slideshows’ ,WSRetCode = ‘GET : Retrieves the zip file with the customer's slideshows
                   ,WSRetCode = ‘201:Ok’
                   ,WSThrows = ‘400:Bad Request,500:Internal Server Error’)
        RETURNS (STRING ATTRIBUTES(WSMedia = ‘application/json’)
                ,STRING ATTRIBUTES(WSAttachment, WSMedia = ‘zip/*’))
  DEFINE jsn base.StringBuffer
  DEFINE ficdia STRING

  LET ficdia = prodisdbs.getDownloadCustomerDiapoPRODIS(jsn:=base.StringBuffer.create(),head_numpro,head_numcli,head_diacli)

  RETURN jsn.toString(),ficdia
END FUNCTION

thank you