Sending embedded data over GET request in JSON format | XM Community
Solved

Sending embedded data over GET request in JSON format

  • 27 February 2020
  • 4 replies
  • 104 views

Hi all,

I have a simple HTTP request I want to make using embedded data. I am using software which is adhering to a certain format when using HTTP request. A simple example would be as follows:

http://host:8080/getaction/exp_id?key=unique_key&context={"user":_unique_user_id_}

I would like to put in an embedded data field with the unique user ID that is in Qualtrics. I've tried many options, but for some reason Qualtrics will not send the embedded data field. Let's say I've created an embedded data field user before adding the web service in the survey flow. Then, intuitively I would think that the following should work:

http://HOST:8080/getaction/exp_id?key=unique_key&context={"user":'${e://Field/user}'}

I've tried using single quotes, double quotes, no quotes. I've also tried adding it as a query parameter, but unfortunately didn't have success yet.

Can anyone give me a pointer to solve this?
icon

Best answer by TomG 1 March 2020, 15:43

View original

4 replies

Userlevel 7
Badge +27
Two things:
1. Use query parameters so they get url encoded
2. Put the user field in double quotes

Your example would look like:
!
Thanks for your reply. I have also tried this, but the response I get from my webservice is:

{"action": {"treatment": "3"}, "context": {"user": "${e://Field/user}"}}

But I should be getting:

{"action": {"treatment": "3", "response":"worked!"}, "context": {"user": "try_out"}}

So the encoding of the URL does not take the embedded data into account it seems?
Userlevel 7
Badge +27
> @Julesmakr said:
> Thanks for your reply. I have also tried this, but the response I get from my webservice is:
>
> {"action": {"treatment": "3"}, "context": {"user": "${e://Field/user}"}}
>
> But I should be getting:
>
> {"action": {"treatment": "3", "response":"worked!"}, "context": {"user": "try_out"}}
>
> So the encoding of the URL does not take the embedded data into account it seems?

Piped strings don't get replaced when click the Test button. You have to actually take the survey to test it.
> @TomG said:
> > @Julesmakr said:
> > Thanks for your reply. I have also tried this, but the response I get from my webservice is:
> >
> > {"action": {"treatment": "3"}, "context": {"user": "${e://Field/user}"}}
> >
> > But I should be getting:
> >
> > {"action": {"treatment": "3", "response":"worked!"}, "context": {"user": "try_out"}}
> >
> > So the encoding of the URL does not take the embedded data into account it seems?
>
> Piped strings don't get replaced when click the Test button. You have to actually take the survey to test it.

Right, that makes sense! It works now, many thanks! 😀

Leave a Reply