Skip to main content

Reading

Every resource client (client.Products, client.Resource<T>(), …) exposes the same read methods.

Get by id​

GetAsync returns the resource, or throws PrestaShopNotFoundException if it doesn't exist:

var product = await client.Products.GetAsync(1);

Find by id​

FindAsync returns null instead of throwing when the resource is missing — use it when "not found" is an expected, non-exceptional outcome:

var product = await client.Products.FindAsync(999);
if (product is null)
{
// doesn't exist — handle it
}
tip

Use GetAsync when the resource should exist (a missing one is a real error). Use FindAsync when you're checking whether it exists. GetAsync throws; FindAsync returns null. Both throw for auth and server errors.

Check existence​

ExistsAsync does a lightweight HEAD request and returns a bool without transferring the entity body:

if (await client.Products.ExistsAsync(1))
{
// ...
}

See Listing for fetching many resources, and Querying for filtering.