简体   繁体   English

PHP Api对象查询

[英]PHP Api Object Query

I'm having a bit of an issue with an API document I'm currently working with. 我目前正在使用的API文档存在一些问题。 The code I've been testing just doesn't seem to work, and I've been looking at it for that long now, I just cannot see where I'm going wrong. 我一直在测试的代码似乎无法正常工作,而且我已经看了很长时间了,我只是看不到哪里出了问题。

API Documentation Screenshot here: https://ibb.co/CW4HRR9 API文档的屏幕快照: https : //ibb.co/CW4HRR9

// POST /package/{id}/web/ftpusers
$args = [
    'update' => [
        'ftp' => [
            'id' => '12345',
            'user' => ['Password' => 'Password123']
        ],
    ],
];
$response = $services_api->postWithFields("/package/".$test_domain_id."/web/ftpusers", $args);
echo '<pre>';
print_r($response);
echo '</pre>';

It just doesn't seem to work, and I'm guessing I'm doing something wrong where it states object and object[] 它似乎似乎不起作用,而且我猜我在声明对象和对象的地方做错了什么。

Looks like I was missing an array object as I've now got this working (extra array within 'ftp' 看起来我缺少一个数组对象,因为现在可以正常工作了(“ ftp”中的额外数组

$args = [ 
    'update'=> [
        'ftp' => [ 
            [
            'id' => $info[0]->Id,
            'user' => [
                'Enabled' => true,
                'Password' => 'Password123'
                ],
            ]
        ],
    ],
];

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM