Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exceptions are thrown when using the export option #13

Open
madrzejewski opened this issue Jan 2, 2025 · 3 comments · May be fixed by #14
Open

Exceptions are thrown when using the export option #13

madrzejewski opened this issue Jan 2, 2025 · 3 comments · May be fixed by #14

Comments

@madrzejewski
Copy link

madrzejewski commented Jan 2, 2025

Hello,

Exceptions are thrown when using the export option on the API.
When using the export option, the response is very limited, we only get the fields we ask for.
It causes errors with some of the object because some fields are required and not expected to be null.

The problem is similar to #12.

I have noticed the issue when using the list option for contacts and domains. The limit field is the one causing the issue.

// Throw an exception
$rtr->domains->list(parameters: [
    'export' => 'true',
    'fields' => 'createdDate'
]);

Capture d’écran_2025-01-02_15-01-53

@zbrag
Copy link
Member

zbrag commented Jan 6, 2025

Nice catch! I've proposed a fix in #14 , as soon as my colleague has time, we shall merge it.

@PJEilers
Copy link
Contributor

PJEilers commented Jan 6, 2025

I recommend using the actual 'export' function when exporting. Maybe we should disallow the export field in the list functionality @zbrag ?

public function export(array $parameters = []): array
    {
        $query = $parameters;
        $query['export'] = 'true';
        $response = $this->client->get('v2/domains', $query);
        return $response->json()['entities'];
    }

@madrzejewski
Copy link
Author

I totally missed the export() function...
I'll check that, thank for the info.

zbrag added a commit that referenced this issue Jan 8, 2025
@zbrag zbrag linked a pull request Jan 8, 2025 that will close this issue
@zbrag zbrag linked a pull request Jan 8, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants