I am using LUNA Rest Server. I tryn to send two parameters to filter the sql query. I see that the format url/api?parameter1=1¶meter2=2 not work. Only for “/” like url/api/parameter.
How can I send the second parameter in this format?
This is my code
APIRequest.SQLStatement = APIRequest.DatabaseConnection.Prepare("SELECT " + APIRequest.SQLColumnsPrepare + " FROM TEST WHERE FIELD1 = ? AND FIELD2 = ?")
APIRequest.SQLStatement.BindType(0, MySQLPreparedStatement.MYSQL_TYPE_STRING)
APIRequest.SQLStatement.Bind(0, APIRequest.RequestPathComponents(2))
APIRequest.SQLStatement.BindType(1, MySQLPreparedStatement.MYSQL_TYPE_STRING)
APIRequest.SQLStatement.Bind(1, APIRequest.RequestPathComponents(2))
@Jose Maldonado:
You could send them like this: http://your-server.com/api/parameter1/parameter2/
Then make a slight modification to your code:
APIRequest.SQLStatement = APIRequest.DatabaseConnection.Prepare(“SELECT " + APIRequest.SQLColumnsPrepare + " FROM TEST WHERE FIELD1 = ? AND FIELD2 = ?”)
APIRequest.SQLStatement.BindType(0, MySQLPreparedStatement.MYSQL_TYPE_STRING)
APIRequest.SQLStatement.Bind(0, APIRequest.RequestPathComponents(1))
APIRequest.SQLStatement.BindType(1, MySQLPreparedStatement.MYSQL_TYPE_STRING)
APIRequest.SQLStatement.Bind(1, APIRequest.RequestPathComponents(2))
You might need to play with the APIRequest.RequestPathComponents index to get the correct values.
I hope this helps.
Works so perfect with this tip. Thanks.