mercredi 22 juin 2016

Mulesoft Anypoint Platform Mock service

I have a problem Working in Api manager of the Anypoint platform at http://ift.tt/1zQpDWY..

I made an API Raml definition and am testing all endpoints using the Mock service. So when making a call to the Api endpoint a mock baseurl is provided and the response consists of the example provided with the called endpoint / http verb. This works fine for GET but when doing a 'Try It' for the POST I get

status 400 error
{
  "error": "body: person: required"
}

as a response. No matter how I provide the body parameters. My endpoint POST definition is:

  post:
    body:
      application/json:
        properties:
          person:
            required: true
            type: object
          token:
            required: true
            type: string
            example: |
              {
                person: {
                "firstName": "John",
                "infix": "",
                "id": "605a0302-cc33-449a-ac50-5ef26e3e3330",
                "emailaddress": "john@doe.nl",
                "lastName": "Doe"
                },
                token: '42E2BC51-6C62-6D46-AC1457446EC4C737'
              }

In the Api workbench' Mocking service pane I enter this in the body:

{
                person: {
                "firstName": "John",
                "infix": "",
                "id": "605a0302-cc33-449a-ac50-5ef26e3e3330",
                "emailaddress": "john@doe.nl",
                "lastName": "Doe"
                },
                token: '42E2BC51-6C62-6D46-AC1457446EC4C737'
              }

but I still get "error": "body: person: required" also if I omit token .... What am |I doing wrong here???

Aucun commentaire:

Enregistrer un commentaire