Announcements
The Google Cloud Community will be in read-only from July 16 - July 22 as we migrate to a new platform; refer to this community post for more details.
Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

How do I create a WADL for a POST with a mediaType of application/x-www-form-urlencoded?

Not applicable

I have created a WADL for import into SmartDocs (see below).

When I place the param elements inside of the representation element, I cannot see any parameters at all in SmartDocs.

With the version below (params appear outside of the method element), I can see the parameters in SmartDocs, but they are sent in the querystring, rather than in the request body. And the params that have a default value are not sent at all, not even in the querystring.

How do I get all the parameters to be sent as form data?

<resource path="oauth/v2/accesstoken"> <param xmlns:xs="http://www.w3.org/2001/XMLSchema" type="xs:string" name="grant_type" style="query" default="authorization_code"> </param> <param xmlns:xs="http://www.w3.org/2001/XMLSchema" type="xs:string" name="code" style="query"> </param> <param xmlns:xs="http://www.w3.org/2001/XMLSchema" type="xs:string" name="client_id" style="query" default="CxTsuE36CG0PVGnOhZiqJPw0x6uEAAiv"> </param> <param xmlns:xs="http://www.w3.org/2001/XMLSchema" type="xs:string" name="client_secret" style="query" default="YteFcBy4814u8vUC"> </param> <param xmlns:xs="http://www.w3.org/2001/XMLSchema" type="xs:string" name="redirect_uri" style="query" default="http://demo26-test.apigee.net/identity_app/callback"> </param> <method id="accesstoken" name="POST" apigee:displayName="Access Token"> <apigee:tags> <apigee:tag primary="true">Access Token</apigee:tag> </apigee:tags> <apigee:authentication required="false"/> <doc apigee:url="http://demo26-test.apigee.net/oauth/v2/accesstoken"> Returns an access token. </doc> <request> <representation mediaType="application/x-www-form-urlencoded"> <apigee:payload required="true"> <apigee:content> </apigee> </apigee> </representation> </request> </method> </resource>
Solved Solved
0 4 3,383
1 ACCEPTED SOLUTION

Not applicable

I'm sure this is not the "right" way, but I was able to get a successful response using this. The SmartDocs experience of providing the value for code is definitely not the way it should be.

I would like to know how an expert would do this.

        <resource path="oauth/v2/accesstoken">
          <param xmlns:xs="http://www.w3.org/2001/XMLSchema" type="xs:string" name="grant_type" style="query" default="authorization_code">
          </param>
          <param xmlns:xs="http://www.w3.org/2001/XMLSchema" type="xs:string" name="code" style="template">
          </param>
          <param xmlns:xs="http://www.w3.org/2001/XMLSchema" type="xs:string" name="client_id" style="query" default="CxTsuE36CG0PVGnOhZiqJPw0x6uEAAiv">
          </param>
          <param xmlns:xs="http://www.w3.org/2001/XMLSchema" type="xs:string" name="client_secret" style="query" default="YteFcBy4814u8vUC">
          </param>
          <param xmlns:xs="http://www.w3.org/2001/XMLSchema" type="xs:string" name="redirect_uri" style="query" default="http://demo26-test.apigee.net/identity_app/callback">
          </param>
          <method id="accesstoken" name="POST" apigee:displayName="Access Token">
            <apigee:tags>
              <apigee:tag primary="true">Access Token</apigee:tag>
            </apigee:tags>
            <apigee:authentication required="false"/>
            <doc apigee:url="http://demo26-test.apigee.net/oauth/v2/accesstoken">
              Returns an access token.
            </doc>
            <request>
              <representation mediaType="application/x-www-form-urlencoded">
                <apigee:payload required="true">
                  <apigee:content>
                    <![CDATA[grant_type=authorization_code&client_id=CxTsuE36CG0PVGnOhZiqJPw0x6uEAAiv&client_secret=YteFcBy4814u8vUC&redirect_uri=http://demo26-test.apigee.net/identity_app/callback&code={code}]]>
                  </apigee:content>
                </apigee:payload>
              </representation>
            </request>
          </method>
        </resource>

View solution in original post

4 REPLIES 4