specify e-form field into "Service URL" in REST service

Comments

6 comments

  • Avatar
    Loren Bratzler

    It is possible and you are on the right track.  You just need to use the fully qualified xPath of your AgilePoint field.  Here is an example from one of my applications where I am doing an REST API call to Box to add an email alias to a Box account.  The URL for the API call includes a process variable from my application that has the user's Box ID (shown in bold here):

    https://api.box.com/2.0/users/${/pd:AP/pd:processFields/pd:BoxUserID}/email_aliases

    0
    Comment actions Permalink
  • Avatar
    Jasperw2000

    Thanks

    0
    Comment actions Permalink
  • Avatar
    Loren Bratzler

    Following up on this.  Maybe I did not understand the original question.  Were you talking about doing a REST process activity?  Or did you mean using a REST service call in an eForm?

    My original answer was based on doing a REST process activity.  I now find myself trying to configure an Auto-Lookup on an eForm that utilizes a REST service call and I need to include variables in the JSON body of the request.  But I can't seem to get it to work either.

    0
    Comment actions Permalink
  • Avatar
    Loren Bratzler

    @Jasperw2000

    If you are still following this and your question was regarding setting up a REST Service call within an eForm, then my original answer was not quite correct.  When you are creating your Request URL, you need to include a $ in front of your variable name. So in your example, your URL should look like this:

    http://test.com/${idBoard}

    When you are creating your URL, you should be able to actually drag the variable from you data model to the URL field.  Here is an example where I am dragging a Form variable named "Project" into my URL field:

    And then when I let go of the mouse button, the URL looks like this:

     

    Sorry for any confusion.

    Also as an FYI - I have a support ticket open with AgilePoint now because I am trying to make a REST Service Lookup call that needs to pull in form variables into the Request Body but that does not appear to be working.

    0
    Comment actions Permalink
  • Avatar
    Loren Bratzler

    I worked with AgilePoint and was able to get my REST Auto-Lookup working.  The issue I was having was in figuring out how to populate the Request Payload.

    In my use case, I am doing a REST Lookup to get an Access Token.  For this call, I need to pass three parameters in the Request Body:

    The mistake I was making is that I was trying to code Form Variables directly into the Payload editor like this:

    In working with AgilePoint support, what we found out was that if you have an AgilePoint variable name in the payload, the call will not work.  The person I was working with said they think it is due to the dollar signs in the variable names.

    So you have to code your payload with place-holders like this:

    and then use the "Map Schema" button to map the form variables to the Request Data:

    The one down side to this was the grant_type variable.  Even though that value never changes (it is always "client_credentials"), I had to define a hidden text box on my form with that default value so that I could pass it in the mapping.  You must map all the Request fields using only the Schema Mapper.

    0
    Comment actions Permalink
  • Avatar
    AgilePoint NX Support

    Thank you Loren, you have detailed the explanation.

    0
    Comment actions Permalink

Please sign in to leave a comment.