Web Service POST

Hi Support ,
Values posted from web service , can’t catch with < cfargument> .
Post : http://127.0.0.1:8888/rest/api/get_cevrim/allcevrim?MAKINA_ID=8&URUN_ID=8&ADET=1&SPARIS_ID=2

When I call this post process, it always saves NULL and 0 to the database.

Can you help me ?
OS : Windows 10 (10.0) 64bit
Java Version : 11.0.7 (AdoptOpenJDK) 64bit
Tomcat Version : Tomcat/9.0.35
Lucee Version : Lucee 5.3.7.47

Lucee Code :

        <cfargument  name="MAKINA_ID" type="String" required="false"  >

        <cfargument  name="URUN_ID" type="String" required="false"  >

        <cfargument  name="ADET" type="String" required="false" >

        <cfargument  name="SPARIS_ID" type="String" required="false" >

    <cfquery name="get_emp" datasource="iot">           

        INSERT INTO URETIM

            (

                MAKINA_ID,

                URUN_ID,

                ADET,

                SPARIS_ID

            )

            VALUES

            (

               '#arguments.MAKINA_ID#',

               '#arguments.URUN_ID#',

               '#arguments.ADET#',

               '#arguments.SPARIS_ID#'    

            )

    </cfquery>

Hi @FingolfiN welcome!!!

Are you using Lucee’s inbuilt REST functionality or a framework (coldbox or taffy)?

If you are using Lucee’s inbuilt rest functionality, you may need to use the specific rest attribute restargsource=“url”. For an example please see the function getTimeZone in the example component here at 4. Creating the REST example application

Please see also this video at https://youtu.be/R_VnRawOhhc (see the part at 3:48)

-Are you using Lucee’s inbuilt REST functionality or a framework (coldbox or taffy)?

+No i do not use ,

  • If you are using Lucee’s inbuilt rest functionality, you may need to use the specific rest attribute restargsource=“url”. For an example please see the function getTimeZone in the example component here at 4. Creating the REST example application

+I share component and function structures with you

        <cfcomponent rest="true" restpath="post_uretim">  
           <cffunction name="uretim"   access="remote" returntype="string" 
             httpmethod="POST"  restpath="uretim"  produces="text/json" >
         </cffunction>
         </cfcomponent>

In your function you are using the httpmethod POST, but you posted a link as

http://127.0.0.1:8888/rest/api/get_cevrim/allcevrim?MAKINA_ID=8&URUN_ID=8&ADET=1&SPARIS_ID=2

That is GET with URL variables. Did you take a look at the example I provided and the video?

1 Like

When I typed restaurgsource=“url” into < cfargument>, I got what I wanted . Thanks for the help
CODE:
<cfargument name= ‘‘MAKINA_ID’’ restargsource=“url” >
<cfargument name= ‘‘URUN_ID’’ restargsource=“url” >
<cfargument name= ‘‘ADET’’ restargsource=“url” >
<cfargument name= ‘‘SPARIS_ID’’ restargsource=“url” >

1 Like