Four Stars

How to build a REST service to get customer information in 2 different ways

Hi all,

 

I try to build a REST service to give the possibility to retrieve customer information in 2 ways with a single URI : by the customer id (integer) or by customer code (String). My first idea is to define a single endpoint as follow Sans titre.pngSans titre1.png

But I don't know if I'm on the right way because from now I didn't find the means to divide my job depending on the given information code or id.

 

Many thanks for your help.

 

Best Regards

3 REPLIES
Five Stars

Re: How to build a REST service to get customer information in 2 different ways

I am new to this aswell, I did some mapping of data gathered from a rest api using trestclient component -> tmap -> tfileoutputXML and then prepare a metada file out of this xml file generated and then point the required coloumns using a tmap and send the data to an excel file. Are you trying to do anything of this sort? please ignore if I am not answering what you are looking for. Thanks.

Eleven Stars

Re: How to build a REST service to get customer information in 2 different ways

Basically you need to set up two Output Flows. One for each. You are going to have to process the inputs differently anyway, so this actually makes it far more logical than trying to apply optional logic within one Output Flow.

 

You might like to take a look here (https://help.talend.com/reader/jomWd_GKqAmTZviwG_oxHQ/53ZgjRgRIZBxKLOrSTD_CA) for some more details on how you can use the tRestRquest.

Rilhia Solutions
Four Stars

Re: How to build a REST service to get customer information in 2 different ways

Hi,

 

Thanks to both of you. I'm gonna take a look and check each track you gave.

 

Best regards,

 

Thomas