养蜂场:忽略无法识别的区块

时间:2015-05-27 06:04:43

标签: rest request response apiblueprint apiary

我在养蜂场有以下定义,用于发布访问权限的服务:

## Access Right [/api/v0.3/accessrights/{id}/assign?isExternalKey=true]

### Assign access rights [Post]            

+ accessRightId (number)
+ personId (string)

+ Parameters
    + id (number) - ID of the Access Right in the form of an integer

+ Request (application/json)

            {
                "personId": "785"
            }

+ Response 201

蜂房告诉我,请求和响应块无法识别。我试图使所需的字段,我做了所需的参数,我改变了字段的拼写,我删除了(application / json),我摆弄了间距。似乎没有任何帮助。 请求和响应块有什么问题?

2 个答案:

答案 0 :(得分:1)

方法名称必须是全部大写,如规范和电汇。

因此,“分配访问权限”行应写成如下:

'mailer' => [
    'class' => 'yii\swiftmailer\Mailer',
    'useFileTransport' => false,
    'transport' => [
        'class' => 'Swift_SmtpTransport',
        'host' => 'localhost',
        'username' => 'username',
        'password' => 'password',
        'port' => '587',
        'encryption' => 'tls',
    ],
],

答案 1 :(得分:0)

通过切换块的顺序(从参数,请求,响应到请求,响应,参数),可以识别请求和响应正文:

## Access Right [/api/v0.3/accessrights/{id}/assign?isExternalKey=true]

### Assign access rights [Post]            

+ accessRightId (number)
+ personId (string)

+ Request (application/json)

            {
                "personId": "785"
            }

+ Response 201

+ Parameters
    + id (number) - ID of the Access Right in the form of an integer

我不确定为什么这很重要,但至少现在API验证为Valid API Blueprint。 问题解决了!