Ask a Question

Endpoint takes reference expression literally

SOLVED
scruzvx
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.
10 REPLIES 10
nmrao
Champion Level 3

@scruzvx 

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

 

Screen shot of the request would help.



Regards,
Rao.
richie
Community Hero

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
sonya_m
SmartBear Alumni (Retired)

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

scruzvx
Occasional Contributor

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

No problem.
You may also look at the documentation
https://support.smartbear.com/readyapi/docs/requests/rest/types.html


Regards,
Rao.
scruzvx
Occasional Contributor

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

 

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
HimanshuTayal
Community Hero

@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
sonya_m
SmartBear Alumni (Retired)

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

cancel
Showing results for 
Search instead for 
Did you mean: