Skip to content

ApiValueError when creating contact. Contact created nonetheless #4

@marcosguedes

Description

@marcosguedes

Creating a contact with the following code throws an error

configuration = egoi_api.Configuration(host=https://api.egoiapp.com)
configuration.api_key["Apikey"] = "xxxxxxxxxxxxxxxx"

with egoi_api.ApiClient(configuration) as api_client:
    api_instance = contacts_api.ContactsApi(api_client)
    path_params = {"list_id": QueryId(100)}
    body = ContactBaseExtraPost(
        base={
            "status": "unconfirmed",
            "language": "pt",
            "email": "test@example.com",
        }
    )

    api_response = api_instance.create_contact(
        path_params=path_params,
        body=body,
    )

Error thrown

  File "env/lib/python3.9/site-packages/egoi_api/api_client.py", line 929, in deserialize
    raise ApiValueError(
egoi_api.exceptions.ApiValueError: Invalid content_type returned. Content_type='application/problem+json' was returned when only {'application/json'} are defined for status_code=409

Request body looks like this

b'{"errors":{"unique_field_in_use":"A unique field is already being used","field_id":"email","contacts":["7b0a9cb172"]},"type":"http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html","title":"Conflict","status":409,"detail":"The request could not be completed due to a conflict with the current state of the target resource"}'

Contact is created as requested, but body throws an error. Am I doing ContactBaseExtraPost wrong?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions