cancel
Showing results for 
Search instead for 
Did you mean: 

Endpoint takes reference expression literally

SOLVED
Highlighted
Occasional Contributor

Endpoint takes reference expression literally

Hi community

I am having an issue to run a REST GET, I need to sent a value as a header and I have a main service that generate the needed ID. In the header I add this reference ${#Project#ID} but the endpoint is literally taken "${#Project#ID}"

I already remove the ${#Project#ID} expression and put the ID generated "gbxsrtuiosnfj2$.483...etc" and it works fine.

I need to mandatory use the ${#Project#ID} or alternative way because this test is going to run automated.

I hope someone be able to help me with this problem.

Thank you.
Tags (1)
1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Hero

Re: Endpoint takes reference expression literally

10 REPLIES 10
Highlighted
Community Hero

Re: Endpoint takes reference expression literally

@scruzvx 

This is very common use case. Something incorrect usage, I believe.

 

Screen shot of the request would help.



Regards,
Rao.
Highlighted
Community Hero

Re: Endpoint takes reference expression literally

Hi @scruzvx,

Just to be clarify.

You have a service that generates the header value required for your GET request which you are writing out to an ID property on your Project. Is that correct?
You have a subsequent GET request with a header value specifying the ${#Project#ID}. Is that correct?

So i'm expecting your testcase object hierarchy to be something like

ServiceRequest RESTstep which returns a value
GET RESTstep which has a header with value of ${#Project#ID}

Is that about right?

HOWEVER when you try executing the whole testcase containing the two teststeps the GET fails and you can see from the RAW of the GET request that the value ofthe header is the literal ${#Project#ID}, so doesnt appear to be parameterised.

The servicerequest step....it returns a header value.....is it returned in a response payload or is it included as one of the responses header values?

Ive used parameterisation in headers lots of times before now and it did work, so as Rao said....if you can provide some screenshots and just answer my questions to clarify, this will no doubt help everyone being able to diagnose whats going wrong and get you working, or at least provide workarounds for you.

Nice one,

Rich
if this helped answer the post, could you please mark it as 'solved'? Also if you consider whether the title of your post is relevant? Perhaps if the post is solved, it might make sense to update the Subject header field of the post to something more descriptive? This will help people when searching for problems. Ta
Highlighted
Community Manager

Re: Endpoint takes reference expression literally

Thanks richie, nmrao!

 

@scruzvx did you find a solution? Please share it with usSmiley Happy

If you are still loking for help, please provide more details the Community is asking for and we will be happy to investigate this further here. Thanks.


Sonya Mihaljova
Community and Education Specialist

Learn SmartBear products in a fun and easy way and prove your knowledge!
>>Participate in the TechCorner Challenge today
Highlighted
Occasional Contributor

Re: Endpoint takes reference expression literally

Sorry guys, I was on vacation.
I going to attach a couple of images.
If I put the ${#project#id} it doesn't work.
Highlighted
Community Hero

Re: Endpoint takes reference expression literally

Highlighted
Occasional Contributor

Re: Endpoint takes reference expression literally

Thank you I will try with that info. I will let you know if it works

 

Highlighted
Community Hero

Re: Endpoint takes reference expression literally

Hi @scruzvx,

Im just wondering about your progress?

Nice one

Rich
if this helped answer the post, could you please mark it as 'solved'? Also if you consider whether the title of your post is relevant? Perhaps if the post is solved, it might make sense to update the Subject header field of the post to something more descriptive? This will help people when searching for problems. Ta
Highlighted
Community Leader

Re: Endpoint takes reference expression literally

@scruzvx : 

 

1. Try to correct the spelling of ID,

2. Try to check that the Test Cases exist in same Project

3. Add a groovy step in same Test Case and use below code, if it works there it should work in header too

 

log.info ${#Project#ID}

 

it should show ID in logs.

 

 


Click "Accept as Solution" if my answer has helped,
Remember to give "Kudos" 🙂 ↓↓↓↓↓



Thanks and Regards,
Himanshu Tayal
Highlighted
Community Manager

Re: Endpoint takes reference expression literally

Community, thanks for the advice!

 

@scruzvx did you have a chance to try the new suggestions? Did it work?


Sonya Mihaljova
Community and Education Specialist

Learn SmartBear products in a fun and easy way and prove your knowledge!
>>Participate in the TechCorner Challenge today
New Here?
Join us and watch the welcome video:
Announcements
TechCorner Leaderboard
Want a fun and easy way to learn ReadyAPI and show off your skills? Try solving weekly TechCorner challenges and get into the Leaderboard!


Challenge Status

Compare an expected JSON value and actual response in Events

Participate!

Fetch value/data from JSON response using Groovy Script

See replies!

Filtering data retrieved from a DataSource

See replies!

Get data from Petstore and add it to Excel sheets

Participate!
Top Kudoed Authors