2

I want to search (say) "accounts" based on "name" or "status".

So I would like to have two actions :

  • GET /persons/?q=name==Jea*
  • GET /persons/?q=status==locked

How can I document that ?

I tried an Action with multiples transactions :

### GET /accounts{?q}

+ Request by name
    +Parameters
        +q (required, FIQLQuery)
        **Only name is supported**

+ Request by status
    +Parameters
        +q (required, FIQLQuery)
        **Only status is supported**

But Apiary editor complains because :

  1. I must provide a message-body for my GET requests:

    Message-body asset is expected to be a pre-formatted code block, every of its line indented by exactly 8 spaces or 2 tabs.

  2. The + Parameters block is not recognized :

    Ignoring unrecognized block

Thanks a lot

4

1 回答 1

0

我可以制定适合我的解决方案。

试试这个 API 蓝图:

FORMAT: 1A

# requestByname

## Accounts [/accounts/?{q,type}]

### GET

+ Parameters
    + q (required, FIQLQuery)
    + type (string, `name` or `status`)

+ Request Name (application/json)

+ Response 200

        {"name": "test"}

+ Request Status (application/json)

+ Response 200

        {"status": 200}
于 2014-10-02T18:39:39.767 回答