C# API Client 2.12 - 2.14.0: AddTag doesn't work


We’re currently working on the C# Crowdin API’s AddTag and we faced this issue:

Unexpected character encountered while parsing value: {. Path 'errors[0].message', line 6, position 18.

I downgraded the version to 2.12, same error happen. On this version, sendPostRequest is accessible so was easier to debug it.

 string subUrl = FormUrl_ScreenshotTags(projectId, screenshotId);
            CrowdinApiResult crowdinApiResult = await _client.SendPostRequest(subUrl, requests);

crowdinApiResult is well responding with a property JsonObject. But it’s fail on _jsonParser.ParseResponseObject, since JsonObject data is an array and ParseResponseObject expect an object.

Here is the exact error on it:

Cannot deserialize the current JSON array (e.g. [1,2,3]) into type 'Crowdin.Api.Screenshots.Tag' because the type requires a JSON object (e.g. {"name":"value"}) to deserialize correctly.
To fix this error either change the JSON to a JSON object (e.g. {"name":"value"}) or change the deserialized type to an array or a type that implements a collection interface (e.g. ICollection, IList) like List<T> that can be deserialized from a JSON array. JsonArrayAttribute can also be added to the type to force it to deserialize from a JSON array.
Path '', line 1, position 1. 

By inspecting the GitHub - crowdin/crowdin-api-client-dotnet: .NET client library for Crowdin API code, we can see that there is no test for the AddTag. Is that even normal?

This issue look like this one C# API Client 2.14.0: StringBatchOperations fires a System.NullReferenceException as i think there is definitly something wrong with ParseResponseObject that is used at several places.

Thanks for your time on this!

To start with, try Postman sandbox tool to see whether the request is run at all. If yes, than it’s not the API but only with particular client, Crowdin has a pre made calls lib there

I’d also suggest you to record the reproduction steps for you issue + full data of your setup and submit a contribution request or issue report in related topic on Github.

Yes, i know that the issue is not API side since it’s works, the issue is on C# client, especially this request: _client.Screenshots.AddTag() that come from this repo: GitHub - crowdin/crowdin-api-client-dotnet: .NET client library for Crowdin API

We where thinking that we should open post on crowdin community, since that look like there is no open issue at all: Issues · crowdin/crowdin-api-client-dotnet · GitHub.

1 Like

In case issue is opened, someone will take a look at it. This is a very system-related issue, I don’t think someone from community can fix this. Need asistance of someone from developers of Crowdin. While they looking at the issue, you can use another client, or the postman, or CLI. Tons of alternativeties that have 15 mins setup