RAML POST application/json request body is not being set by Mulesoft API Designer


#1

Hi,

I have a RAML definition that does a POST with a content type of application/json.
I have it defined in Mulesoft Web API Designer.

RAML definition follows this format,

post:
is: [ head ]
description: |
Description
body:
application/json:
schema: |

example: |

The example shows up fine in “Try it” BODY section. But then when I try to test the API, I can see from Chrome --> Inspect Element that the request body is not being set.

Can someone please help me here identify the issue.

Thanks,
Arun


#2

Can you describe step by step what you’ve done please? Maybe we can reproduce it.


#3

Hi Christian,

I have a working API hosted. I am trying to use RAML to integrate with the API and see how it looks in Mulesoft API Designer.

It’s a POST API, accepting a request payload of type application/json. The API as such is secured by oauth_2_0, which works fine.

In the post: section, I give a description, body (type application/json), a schema for the json and an example.

The example does show up in “Try it” section but when the actual POST happens it is missing the Request Payload part. So I would like to know what I am missing in the RAML definition that doesn’t post the request payload.

Thanks,
Arun


#4

Hi Christian,

I have an update, it looks like because I am securing the resource with oauth_2_0 it’s not sending the body. If I remove it it’s sending the body but of course my API platform returns a 401.

How to secure a resource (securedBy: [ oauth_2_0 ]) and also ensure that the subsequent request, a POST with a json body in this case, also works.

Thanks,
Arun