UpCloudLtd / upcloud-php-api

PHP client for UpCloud's API
MIT License
24 stars 18 forks source link

Zone API returning empty 'name' column while 'id' is expected #14

Closed Cannonb4ll closed 5 years ago

Cannonb4ll commented 6 years ago

I am using this package for reference.

Currently trying to get the Zones through this package, which works but I am not getting the 'id' column, I am getting an empty/null 'name' column. (See image below)

Your documentation @ https://www.upcloud.com/api/5-zones/#zones states that it should return an ID and description.

What is going wrong?

Image

Cannonb4ll commented 6 years ago

My code:

        $upCloud = new \Upcloud\ApiClient\Upcloud\ZoneApi();
        $config = $upCloud->getConfig();
        $config->setUsername('***');
        $config->setPassword('***');

        dd($upCloud->listZones());
Cannonb4ll commented 6 years ago

For now hardcoded in our console command job, but really want to make this dynamic through api:

        $plans = [
            [
                'name' => 'Frankfurt #1',
                'id' => 'de-fra1'
            ],
            [
                'name' => 'Helsinki #1',
                'id' => 'fi-hel1'
            ],
            [
                'name' => 'Amsterdam #1',
                'id' => 'nl-ams1'
            ],
            [
                'name' => 'Singapore #1',
                'id' => 'sg-sin1'
            ],
            [
                'name' => 'London #1',
                'id' => 'uk-lon1'
            ],
            [
                'name' => 'Chicago #1',
                'id' => 'us-chi1'
            ],
        ];
Darep commented 6 years ago

Oh, sorry about that! Glad that you found a workaround 👍 Yeah the "name" field should be "id" in the result, seems like it was mis-named in the Zone model. We'll have a look at that!

Darep commented 6 years ago

PR at https://github.com/UpCloudLtd/upcloud-php-api/pull/15