Question

Photo of Gary Holeman

0

Forming body of Lava webrequest

Does anyone have an example of how to form the body for the Lava WebRequest? I've been able to use Lava WebRequest for anything that doesn't require a body. I'm guessing it is a syntax issue, but I can't find an example of how to format the lava block. Keeping it simple, I'm trying right now just to login to the rocksolidchurchdemo site using the following lava block:

{% webrequest url: 'http://rock.rocksolidchurchdemo.com/api/Auth/Login' requestcontenttype:'application/json' responsecontenttype:'application/json' method:'POST' body: '{"Username" : "admin","Password" : "admin","Persisted" : "true"}' %}

{{result}}

{% endwebrequest %}

No matter how I try to form this, the constant result back is : Liquid error: The given key was not present in the dictionary. 

I've tried assigning a json variable to the body text using the FromJSON filter, but I get the same result.

Anyone point me in the right direction?  Any example of a webrequest with a body in it?

  • Photo of Gary Holeman

    0

    Well, Jon Edmiston solved this for me over in the Rocket.Chat #develop channel.  Though I thought I had tried every possible pattern, the problem is the space after the colon on body:.  No space allowed after the tag.