2019 Sep 21 5:33 AM - edited 2024 Feb 04 6:23 AM
Hi experts,
I am using the postman to get some data of the API.But I find out that the API generated from the CPI couldn't identity the parameters that I added and thus the filter conditions doesn't work.For example,I just want to get some records of the employeeA, but it always returned all records of the employees to me. I really have on idea what should I do to filter some data of the API by using the postman.
below is the integration I created on the CPI
and then I copy the endpoint to the postman and try to add some filter conditions but it didn't work!
Could anyone help me to solve the issue?Super thank!!!
Request clarification before answering.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Sriprasad,
Your answer help me a lot and it does work.Super thanks!
Regards,
Christy
Hello Sriprasad,
I have another problem with the above situation recently. When I added the "filter" in the CPI and the postman at the same time, it seemed couldn't work both.Only the "filter" parameter of the CPI could be identified.
below is the query option of the OData:
below is the query on the postman and the return result:(as you can see, I add one more parameter "highestDegree" to get the target record,and I hope to combine the "filter" option of the CPI and the postman,but it seemed couldn't identify the parameter "higestDegree")
So how could I combine the parameters to get the target record, do you have any ideas about this?Very grateful for your help again!!
Regards,
Christy
Hi Morten,
Very thank you for your reply.
But I am still have some problems on this issue, because I have already done some filter conditions on the CPI, but the clients want to do more filters condition on the postman based on my API.And after I added the "${header.CamelHttpQuery}"on the query option,the postman return below error to me.
I guess that's because I did not set this parameter, so I set the "CamelHttpQuery" header using the content modifier.like below.
At the same time ,I define the parameters in the groovy script.
After I made above settings,it seems still doesn't work .I don't know if it's possible to do a second filter on postman.Do you have any further ideas about the issue?Any advises would be appreciated.
Best regards.
Christy
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Christy
First off, please comment on my answer, instead of creating a new answer. If makes following the thread harder.
Next, you don't need to create the CamelHttpQuery header. It is created automatically by the HTTPS sender.
Also, is there a good reason the OData service is not just called directly? What are you adding in CPI, specifically? You obviously need an OData service, but what you are exposing is just an HTTPS endpoint.
Regards,
Morten
Hi Christy
The query parameters you provide are for the sender HTTPS adapter, not the receiver OData adapter; the latter never sees them. That's why they have no effect on the data returned by the OData service.
The parameters the HTTPS adapter receives, are placed in the CamelHttpQuery header. So what you could do, is use the contents of this header in the Query Options field of the OData receiver channel:
This will pass all query parameters on to the OData service (including any that might not actually be query options).
Regards,
Morten
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Morten,
Below is the query option I added on the OData adapter.
Because the HTTPS endpoint is what I delivery to the client, they hope to get some data from the API and do some filter on the postman.So,is it possible to pass the query parameters to the Odata adapter by the postman?And you mentioned about the OData Services, is it a way to solve this problem?
Very grateful for your reply again!
Hi alltan_7099
Passing on query parameters using ${header.CamelHttpQuery} does work. I tried it, of course, before posting the answer.
It's not clear to me, if you maybe want to combine the parameters from Postman, with some fixed query parameters set by you. In that case, you probably need to combine the two in a script, store the result in a property, and then reference that property in your OData query options as ${property.propertyNameHere}.
When combining the header value and your fixed query options, keep in mind the header might be empty. If it isn't, combine the two strings with a & in the middle.
Regards,
Morten
Hi Morten,
I really want to combine the parameters from Postman with some fixed query parameters set on the OData query options.And it seems that I need to get the parameter from postman first and store it as a property, so I could add the property behind the OData query options.Do you have any ideas or samples to get the query parameters of the postman using the script?Really really grateful for your help again!!!
Best regards.
Christy
User | Count |
---|---|
76 | |
30 | |
10 | |
8 | |
8 | |
7 | |
7 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.