Rest api > mysql proc (two params) > json post data


#1

Hi,

I’m getting the following message after make a cUrl POST to REST API:
“Failed to call database stored procedure.\nSQLSTATE[42000]: Syntax error or access violation: 1318 Incorrect number of arguments for PROCEDURE MYSCHEMA.insert_neworder; expected 2, got 1”

My procedure have two parameters: (IN ORDERID INT, IN USERID INT).

cURL command (failed):

curl -kv -X POST --header ‘Content-Type: application/json’ --header ‘
Factory-Api-Key: MYAPIKEY’ --header ‘Authorization: Basic MYAUTH’ -d ‘{“params”:[{“name”:“userid”,“value”:1234},{“name”:“orderid”,“value”:1234}]}’ ‘https://MYDOMAIN/api/
v2/mysql/_proc/insert_neworder’

The same happens when I make the call using the REST API form inside DF. I’m using the following Data to fill the form, and getting the same message:
{“params”:[{“name”:“orderid”,“value”:1234},{“name”:“userid”,“value”:1234}]}

EDIT:
I’m using the Community edition (top-version, checked). I’ve tried with string values, same error. Inverting parameters (one of the examples posted here is inverted), same error. After change the procedure definition in MySQL (the old version had only one parameter), I did make a ?refresh=true call in the source. I have created Role and App definitions after refresh too (working fine with other apps).

I can’t figure out whats is happening.


#2

Config > Cache > Flush System-Wide Cache

Solved. :slight_smile:


#3

Thanks Ivo_Necchi… I spent the best part of a day trying to find a solution, thinking I was going crazy.
I must admit I am rather frustrated that the cause is not on my side but caching in DreamFactory, arghhhh!

If anyone else gets the error with MySQL STORED PROCEDURE …

Error Code: 1064. You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near just do:

Config > Cache > Flush System-Wide Cache