Uploaded image for project: 'PUBLIC - Liferay Portal Community Edition'
  1. PUBLIC - Liferay Portal Community Edition
  2. LPS-159037

Not possible to get the ZIP file in REST Builder autogenerated client for GET ImportTask content response

Details

    Description

      When using the auto-generated client created by the REST Builder, it is not possible to recover the correct content of the ZIP file returned by the endpoint /v1.0/import-task/1/content of the Headless Batch Engine API.

      How to reproduce it:

      Create a succeed Import Task, for example with the following curl:

       curl -X POST \
            'http://localhost:8080/o/headless-batch-engine/v1.0/import-task/com.liferay.headless.delivery.dto.v1_0.BlogPosting?siteId=20124' \
             -H 'accept: application/json' \
             -H 'Content-Type: application/json' \
             -u '[email protected]:test' \
             -d '[ { "headline": "Test Blog Entry 1", "articleBody": "Test Blog Entry 1" }, { "headline": "Test Blog Entry 2", "articleBody": "Test Blog Entry 2" }]'
      

       The response should be similar to:

      {
          "className": "com.liferay.headless.delivery.dto.v1_0.BlogPosting",
          "contentType": "JSON",
          "errorMessage": "",
          "executeStatus": "STARTED",
          "externalReferenceCode": "MYCODE",
          "failedItems": [],
          "id": 1,
          "importStrategy": "ON_ERROR_FAIL",
          "operation": "CREATE",
          "processedItemsCount": 0,
          "startTime": "2022-07-26T11:01:14Z",
          "totalItemsCount": 0
      }
      

      With the given id, in this case 1, make a request using the auto-generated client of the module headless-batch-engine-client:

      ImportTaskResource.Builder builder = ImportTaskResource.builder();
      
      importTaskResource = builder.authentication(
      	"[email protected]", "test"
      ).locale(
      	LocaleUtil.getDefault()
      ).build();
      
      HttpInvoker.HttpResponse httpResponse = importTaskResource.getImportTaskContentHttpResponse(1L);
      
      FileOutputStream fileOutputStream = new FileOutputStream("example-file.zip");
      
      fileOutputStream.write(httpResponse.getContent().getBytes());
      fileOutputStream.flush();
      fileOutputStream.close();
       
      

       
      Expected behaviour:

      The zip file is generated successfully

      Current behaviour:

      The zip file is not generated successfully

       

      Attachments

        Issue Links

          Activity

            People

              susan.chen Susan Chen
              carlos.correa Carlos Correa
              Kiyoshi Lee Kiyoshi Lee
              Carlos Correa Carlos Correa
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                6 weeks, 1 day ago

                Packages

                  Version Package
                  7.0.X
                  7.1.X
                  7.2.X
                  7.3.X
                  7.4.3.37 CE GA37
                  7.4.3.38 CE GA38
                  Master