criteo / criteo-api-python-sdk

4 stars 3 forks source link

Search campaigns returns "Invalid type for variable 'value'" when it is null #6

Closed 4ndt3s closed 2 years ago

4ndt3s commented 2 years ago

Version: v2022_04 Endpoint: marketing-solutions/campaigns/search Problem: Using Postman to fetch the campaigns search endpoint returns:

{
    "data": [
        {
            "id": "123456",
            "type": "Campaign",
            "attributes": {
                "name": "A name",
                "advertiserId": "54321",
                "objective": "CatalogSales",
                "spendLimit": {
                    "spendLimitType": "uncapped",
                    "spendLimitRenewal": "undefined",
                    "spendLimitAmount": {
                        "value": null
                    }
                }
            }
        }
    ]
}

When the same endpoint is fetched with the SDK it returns:

ApiTypeError: Invalid type for variable 'value'. Required value type is float and passed type was NoneType at ['received_data']['data'][0]['attributes']['spend_limit']['spend_limit_amount']['value']

4ndt3s commented 2 years ago

A similar problem when searching adsets, if the end time is null the SDK returns:

ApiTypeError: Invalid type for variable 'value'. Required value type is datetime and passed type was NoneType at ['received_data']['data'][0]['attributes']['schedule']['end_date']['value']

PaulMathon commented 2 years ago

Hi @4ndt3s, Thanks for reporting this issue. Indeed the SDK should support null values here. The swagger from which the client is generated needs to be updated, the process for that is ongoing and will take a few more days. I'll let you know once a patch including the fix is available. Thanks again for helping us improve our solution.

manualaman5 commented 2 years ago

Hello,

I am blocked by this issue. I see that there has been a merge with the fix, but it hasn't been released. Do you have an ETA for this release?

Thanks, Manu

4ndt3s commented 2 years ago

Hi @PaulMathon, thank you for your response.

I am also waiting for this fix to be reflected in the SDK.

Regards.

PaulMathon commented 2 years ago

Hi all, The fix has been released on 06/22/2022 🎉. To use it please install the package's latest version (2022.04.0.220624 for Criteo API version 2022-04). Let me know if you have any further questions. Thank you.

4ndt3s commented 2 years ago

Hi @PaulMathon

I have tested the updated package. The problem is fixed when searching campaigns, but it persists when searching ad sets:

ApiTypeError: Invalid type for variable 'bid_amount'. Required value type is NillableDecimal and passed type was NoneType at ['received_data']['data'][0]['attributes']['bidding']['bid_amount']