postman创建用户 [ 2.0 版本 ]
请问使用postMan插件进行测试的时候使用api.test.com/users可以得到数据,但是使用api.test.com/users?username=test123&email=test123@qq.com&password=1234567以post方式发送时就发生错误
{"name":"Integrity constraint violation","message":"SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '' for key 'username'\nThe SQL being executed was: INSERT INTO user (status, created_at, updated_at) VALUES (10, 1448523987, 1448523987)","code":23000,"type":"yii\db\IntegrityException","file":"/Applications/MAMP/htdocs/advanced/vendor/yiisoft/yii2/db/Schema.php","line":628,"stack-trace":["#0 /Applications/MAMP/htdocs/advanced/vendor/yiisoft/yii2/db/Command.php(791): yii\db\Schema->convertException(Object(PDOException), 'INSERT INTO `us...')","#1 /Applications/MAMP/htdocs/advanced/vendor/yiisoft/yii2/db/Schema.php(448): yii\db\Command->execute()","#2 /Applications/MAMP/htdocs/advanced/vendor/yiisoft/yii2/db/ActiveRecord.php(454): yii\db\Schema->insert('{{%user}}', Array)","#3 /Applications/MAMP/htdocs/advanced/vendor/yiisoft/yii2/db/ActiveRecord.php(424): yii\db\ActiveRecord->insertInternal(NULL)","#4 /Applications/MAMP/htdocs/advanced/vendor/yiisoft/yii2/db/BaseActiveRecord.php(593): yii\db\ActiveRecord->insert(true, NULL)","#5
共 1 个回答
-
KillMeAgain 回答于 2015-11-27 11:34 举报
PUT
数据不是跟在URL后面的,是填在request body中的
cgp
注册时间:2015-10-27
最后登录:2015-12-15
在线时长:5小时32分
最后登录:2015-12-15
在线时长:5小时32分
- 粉丝1
- 金钱140
- 威望0
- 积分190