2

I'm writing some API definitions with apiary/api blueprint.

Is there a way that, for the same resource, I can use the mock endpoint to behave differently depending on input (or failing that, some kind of work around)?

For example, say I have an endpoint /login, to which you are supposed to post a username and password.

If I set up a request and response in the API that successfully logs me in, and subsequent requests and response that are error scenarios, only the first one gets triggered in the mock.

So for example, if I don't send in a username and password, I still get the logged in successfully response.

Is there any way to get the mock to do more validation or how do you work around this?

Thanks

user384842
  • 1,946
  • 3
  • 17
  • 24

2 Answers2

0

Yes, it is possible and thoroughly described in the documentation. See http://support.apiary.io/knowledgebase/articles/117119-handling-multiple-actions-on-a-single-resource

Petr
  • 3,214
  • 18
  • 21
  • Thanks. The link you provided does not appear to deal with parameters, only different Content Types? There is a link on that page to a page about different parameters, but that doesn't deal with question of posting different parameters as the body to a resource, as in my question? Thanks. – user384842 Mar 04 '15 at 16:15
  • Oh, I see. That's not possible. – Petr Mar 06 '15 at 08:42
0

That feature is not implemented yet, but is being worked on. Have a look at MSON, please.

Ján Sáreník
  • 1,517
  • 1
  • 16
  • 13