One Star

[resolved] [tRESTRequest] REST API Mapping, Errors Handling/Wrong Calls

Hi everyone,
I want to have tRESTRequest components which have different output flow with the same URI pattern “/” :
https://www.talendforge.org/forum/img/members/320841/tRESTRequest-Orders.jpg
Each output flow have parameters like :
https://www.talendforge.org/forum/img/members/320841/tRESTRequest-getOrders.jpg
https://www.talendforge.org/forum/img/members/320841/tRESTRequest-getOrdersFromProvider.jpg
But when i run the job only the first output flow (getOrders) is used, and he return me an error cause i don’t use the same parameters.
It is possible to make different flow with the same URI Pattern if they don’t have same parameters (and parameters can’t be null) ? and when a parameter is null tRESTRequest use Wrong Call flow or another custom error flow ?

Edit : I also have a date error, as you can see i have a date parameter (i supposed that is a java.util.Date).
to use it in my tOracleInput i tried :
"SELECT * FROM X.Orders WHERE orderDate >= '" + (new java.sql.Date(((Date)globalMap.get("vGetOrders.after")).getTime())) + "'

But he return me an error cause the java.sql.Date is convert to string and he return 2016-01-01 instead of comparing the sql date with the oracle date.
Thanks you in advance,
CSen.
2 REPLIES
Employee

Re: [resolved] [tRESTRequest] REST API Mapping, Errors Handling/Wrong Calls

Hi, in this case have a single mapping only, then have a filter may be that will either get all orders or orders by id/provider, depending on whether id/provider is not empty.
The query parameters are not used in the JAX-RS matching algorithm, hence when you have 3 methods with the identical HTTP Verb and Path values, the selection is random or as in this case, the 1st matching method gets selected
HTH, Sergey
One Star

Re: [resolved] [tRESTRequest] REST API Mapping, Errors Handling/Wrong Calls

Hi,
I just put a tMap and i use 3 different outputs and that works fine, Thanks.
For the date parameters i will probably use a String.