Forum Discussion

scruzvx's avatar
scruzvx
Occasional Contributor
5 years ago

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.
  • 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.

     

     

    • sonya_m's avatar
      sonya_m
      SmartBear Alumni (Retired)

      Community, thanks for the advice!

       

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

  • nmrao's avatar
    nmrao
    Champion Level 3

    scruzvx 

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

     

    Screen shot of the request would help.

    • richie's avatar
      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
      • sonya_m's avatar
        sonya_m
        SmartBear Alumni (Retired)

        Thanks richie, nmrao!

         

        scruzvx did you find a solution? Please share it with us:smileyhappy:

        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.