Skip to content

Can't call ValidateCompanyData or LocationSearch #4

Description

@tNRevan

Hello,

I am trying out the SDK. But I can't manage to get a successful call. I tried calling ValidateCompanyData or LocaltionSearch. When I log into Foxentry, I can see the requests there. So the server probably responded and the error is in SDK deserialization. This is the code used:

var config = new OpenAPIConfig();

config.SetTokenValue("MY-KEY");

var sdk = new Sdk(config);

var response = await sdk.Company.ValidateCompanyData(new FoxentrySdk.Services.CompanyService.ValidateCompanyDataRequestBody
{
    Request = new ValidateCompanyDataRequest
    {
        Query = new ValidateCompanyDataRequest.ValidateCompanyDataRequestQuery
        {
            RegistrationNumber = "63997240"
        }
    },
});

Throws:

Unhandled exception. System.Collections.Generic.KeyNotFoundException: The given key 'foxentry-daily-credits-left' was not present in the dictionary.
   at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
   at FoxentrySdk.Services.CompanyService.ValidateCompanyData(ValidateCompanyDataRequestBody requestBody, Nullable`1 foxentryIncludeRequestDetails)

And another try (the setup is same to the one above):

var searchResult = await sdk.Location.LocationSearch(new FoxentrySdk.Services.LocationService.LocationSearchRequestBody
{
    Request = new LocationSearchRequest
    {
        Query = new LocationSearchRequest.LocationSearchRequestQuery
        {
            Type = LocationSearchRequest.LocationSearchRequestQuery.LocationSearchRequestQueryType.STREET_WITH_NUMBER,
            Value = "Soch"
        }
    }
});

And exception:

Unhandled exception. System.Text.Json.JsonException: JSON deserialization for type 'FoxentrySdk.Services.LocationService+LocationSearchResponse' was missing required properties, including the following: headers
   at System.Text.Json.ThrowHelper.ThrowJsonException_JsonRequiredPropertyMissing(JsonTypeInfo parent, BitArray requiredPropertiesSet)
   at System.Text.Json.Serialization.Converters.ObjectDefaultConverter`1.OnTryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value)
   at System.Text.Json.Serialization.JsonConverter`1.TryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value, Boolean& isPopulatedValue)
   at System.Text.Json.Serialization.Metadata.JsonPropertyInfo`1.ReadJsonAndSetMember(Object obj, ReadStack& state, Utf8JsonReader& reader)
   at System.Text.Json.Serialization.Converters.ObjectDefaultConverter`1.OnTryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value)
   at System.Text.Json.Serialization.JsonConverter`1.TryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value, Boolean& isPopulatedValue)
   at System.Text.Json.Serialization.JsonConverter`1.ReadCore(Utf8JsonReader& reader, JsonSerializerOptions options, ReadStack& state)
   at System.Text.Json.Serialization.Metadata.JsonTypeInfo`1.ContinueDeserialize(ReadBufferState& bufferState, JsonReaderState& jsonReaderState, ReadStack& readStack)
   at System.Text.Json.Serialization.Metadata.JsonTypeInfo`1.DeserializeAsync(Stream utf8Json, CancellationToken cancellationToken)
   at System.Net.Http.Json.HttpContentJsonExtensions.ReadFromJsonAsyncCore[T](HttpContent content, JsonSerializerOptions options, CancellationToken cancellationToken)
   at FoxentrySdk.Core.HttpRequest.Request[T](ApiRequestOptions options)
   at FoxentrySdk.Services.LocationService.LocationSearch(LocationSearchRequestBody requestBody, Nullable`1 foxentryIncludeRequestDetails)

SDK version: 1.0.1
Windows 10 Enterprise 10.0.19045 Build 19045 x64
.Net Version: 8.0.10
Console project

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions