Hi Plum
I have a requirement to invoke a REST API for which both request & response have a format as "application/json".
Relevant section of WADL from REST API is pasted below.
In order to implement it I am using <data> tag and setting enctype as "application/json" but still I am getting error as "Unsupported encoding type: application/json".
Does Plum support this encoding? Please let me know.
Also let me know what value I need to use for "rawexpr" attribute.
An Example will be great. Thanks a lot.
------
<resource path="card/order/activationRequest">
<method name="POST">
<request>
<representation mediaType="application/json"/>
</request>
<response>
<representation mediaType="application/json"/>
</response>
</method>
</resource>
------
We've Moved! Please visit our new and improved forum over at our new portal: https://portal.plumvoice.com/hc/en-us/community/topics
Rest API - enctype & rawexpr
Re: Rest API - enctype & rawexpr
Hi Vikas,
Unfortunately, "application/json" is not yet a supported encoding type for <data> tag responses. For the moment, only requests can be encoding using json. JSON responses are a feature that is in the pipeline for the next release of our platform, but we do not yet have a release date estimate for this version.
For now, our recommendation is that you use a server-side scripting language such as PHP to interact with your REST API and its JSON responses.
Regards,
Plum Support
Unfortunately, "application/json" is not yet a supported encoding type for <data> tag responses. For the moment, only requests can be encoding using json. JSON responses are a feature that is in the pipeline for the next release of our platform, but we do not yet have a release date estimate for this version.
For now, our recommendation is that you use a server-side scripting language such as PHP to interact with your REST API and its JSON responses.
Regards,
Plum Support
Plum Support
http://www.plumvoice.com
http://www.plumvoice.com
Re: Rest API - enctype & rawexpr
Thanks for reply.
Please let me know the response type that is supported by Plum at this point.
Also let me know am I right using "enctype" for JSON request. or is there some other attribute that I need to set for JSON request?
How is 'rawexpr' attribute used?
Please let me know the response type that is supported by Plum at this point.
Also let me know am I right using "enctype" for JSON request. or is there some other attribute that I need to set for JSON request?
How is 'rawexpr' attribute used?
Re: Rest API - enctype & rawexpr
Hi Vikas,
At this point, only XML responses are supported by the data tag.
When submitting json data, you will want to set three things:
Here the rawexpr is pointing to a variable that contains the data in json format as a string.
Regards,
Plum Support
At this point, only XML responses are supported by the data tag.
When submitting json data, you will want to set three things:
- method="raw"
enctype="application/json"
rawexpr="{some expression evaluating to a json string}"
Code: Select all
<?xml version="1.0"?>
<vxml version="2.1">
<form>
<var name="submitData" expr="'{"id": 1, "passcode": "2245"}'" />
<data name="responseData" src="validateRestService.xml" method="raw" enctype="application/json" rawexpr="submitData" />
<block>
Hello <value expr="responseData.documentElement.firstChild.toString()"/>.
</block>
</form>
</vxml>
Regards,
Plum Support
Plum Support
http://www.plumvoice.com
http://www.plumvoice.com