Skip to content
This repository was archived by the owner on Jan 19, 2024. It is now read-only.
This repository was archived by the owner on Jan 19, 2024. It is now read-only.

[BUG] Can't create Asset #147

Open
Open
@ypiel-talend

Description

@ypiel-talend

Describe the bug
We can't create Asset since we can't set AssetType.

To Reproduce
We tried this code:

ETAsset asset = new ETAsset();
asset.setName("Asset Test 1");
asset.setContent("Asset Test 1 content");
asset.setContentType("text/plain");

ETResponse<ETAsset> etAssetETResponse = client.create(asset);

And this issue is returned:

{"message":"Request contained some validation errors.","errorcode":10006,"documentation":"","validationErrors":[{"message":"You must provide a valid AssetType for the Asset.","errorcode":118075,"documentation":""}]}

We also tried with a direct HTTP call. We have the same issue if AssetType is not set, but successful with this code:

String payload = """
        {
          "Name": "Asset 1",
          "AssetType": {
            "Id": 1
          },
          "Data": {
            "message": "A message"
          }
        }
""";

String rest_endpoint = this.getConf().get("endpoint") + "asset/v1/content/assets";

HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
        .uri(URI.create(rest_endpoint))
        .header("Content-Type", "application/json")
        .header("Authorization", "Bearer " + token)
        .POST(HttpRequest.BodyPublishers.ofString(payload, StandardCharsets.UTF_8))
        .build();

HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());

Expected behavior
There is no ETAssetType attribute in ETAsset, but it is mandatory to create an Asset.

Environment

  • Fuel SDK Version 1.6.0
  • Java/ JDK version 11

The bug has the severity

  • Critical: The defect affects critical functionality or critical data. It does not have a workaround.
  • Major: The defect affects major functionality or major data. It has a workaround but is not obvious and is difficult.
  • Minor: The defect affects minor functionality or non-critical data. It has an easy workaround.
  • Trivial: The defect does not affect functionality or data. It does not even need a workaround. It does not impact productivity or efficiency. It is merely an inconvenience.

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions