Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API: Create a new version of the content on a second language #30950

Closed
Tracked by #30371
hmoreras opened this issue Dec 16, 2024 · 7 comments · Fixed by #30992 or #31020
Closed
Tracked by #30371

API: Create a new version of the content on a second language #30950

hmoreras opened this issue Dec 16, 2024 · 7 comments · Fixed by #30992 or #31020

Comments

@hmoreras
Copy link
Contributor

hmoreras commented Dec 16, 2024

Parent Issue

User Story

As a user, I want to create a new content in another language that is related to an existing content, so that I can have content available in multiple languages through the REST API of workflows.

Acceptance Criteria

  1. Develop functionality to create a new content version in a different language.
  2. Ensure the new language version is linked to the original content.
  3. Implement REST API endpoint to support multilingual content creation.
  4. Validate that the relationship between original and translated content is maintained.
  5. Provide a mechanism to specify the source language and target language.
  6. Ensure that metadata and key attributes are preserved across language versions.
  7. Implement proper error handling for language content creation.
  8. Verify that the new language version can be retrieved and managed via the REST API.

Proposed Objective

Core Features

Proposed Priority

Priority 2 - Important

External Links... Slack Conversations, Support Tickets, Figma Designs, etc.

No response

Assumptions & Initiation Needs

  • Existing REST API workflow infrastructure is in place.
  • Supported languages and their codes are predefined.
  • Content model supports multilingual attributes.
  • Translation process or mechanism is to be determined.

Quality Assurance Notes & Workarounds

  • Test content creation with various language combinations.
  • Verify referential integrity between original and translated content.
  • Check API responses for multilingual content operations.
  • Validate that all required fields are properly handled during translation.

Sub-Tasks & Estimates

No response

Copy link

github-actions bot commented Dec 19, 2024

jdotcms added a commit that referenced this issue Dec 20, 2024
jdotcms added a commit that referenced this issue Dec 23, 2024
@jdotcms jdotcms moved this from In Progress to In Review in dotCMS - Product Planning Dec 23, 2024
@jdotcms
Copy link
Contributor

jdotcms commented Dec 23, 2024

In order to test this issue, please see postman, the Workflow Resource Test / SavingOnDiffLanguageByActionId
it creates a French language
creates a content in english
and finally creates a content in french, but with the same id of the previous step

jdotcms added a commit that referenced this issue Dec 26, 2024
jdotcms added a commit that referenced this issue Dec 26, 2024
github-merge-queue bot pushed a commit that referenced this issue Dec 26, 2024
#30992)

Previously this change when firing a workflow by action id to an
existing contentlet but in a diff language, wasnt working
Basically the isWorking perform over the new language which does not
exist, this new change test a third option which is look for a version
info in another language to proceed
@github-project-automation github-project-automation bot moved this from In Review to Done in dotCMS - Product Planning Dec 26, 2024
@freddyDOTCMS freddyDOTCMS moved this from Done to Internal QA in dotCMS - Product Planning Dec 27, 2024
@freddyDOTCMS freddyDOTCMS self-assigned this Dec 27, 2024
@freddyDOTCMS
Copy link
Contributor

Needs Work: This case is not working propertly

  • Create a ContentType named type_1 with 2 fields: title and secondField, both Text
  • Create a couple of locales, French and Italian
  • Create a new Contentlet from the Content Type created previously with: title: English; secondField: A
  • Now create a new version of the Contentlet but for French, using the new Workflow

Method: PUT
URL: {dotcmsEndpoint}/api/v1/workflow/actions/ceca71a0-deee-4999-bd47-b01baa1bcfc8/fire?identifier={content identifier}&lang=1&indexPolicy=WAIT_FOR
body: 
{
    "contentlet":{        
        "identifier":"content Identifier",
        "languageId":"French Id",
        "contentType":"Type1",
        "title":"French",
        "secondField": "B",
        "contentHost":"default"
    }
}
  • Now create a new version of the Contentlet but for Italian, using the new Workflow

Method: PUT
URL: {dotcmsEndpoint}/api/v1/workflow/actions/ceca71a0-deee-4999-bd47-b01baa1bcfc8/fire?identifier={content identifier}&lang={French Language Id}&indexPolicy=WAIT_FOR
body: 
{
    "contentlet":{        
        "identifier":"content Identifier",
        "languageId":"Italian Id",
        "contentType":"Type1",
        "title":"Italian",
        "contentHost":"default"
    }
}

The secondField value should be B because the original is the French version but it is A

@freddyDOTCMS
Copy link
Contributor

Needs Work:

  • If you set a language that does not exists as target then you got a 500 HTTP response error and the message is not readable at all
{
    "message": "ERROR: insert or update on table \"contentlet\" violates foreign key constraint \"fk_contentlet_lang\"\n  Detail: Key (language_id)=(999999) is not present in table \"language\"."
}
  • If you set the target language Id as "0" or something like "00000", then you got 200 and the Default language version got updated

  • If you set a Contentlet that does not exists in the request body or the query parameter, you got a 400 HTTP Response and the not readable message


{
    "message": "The content (id da3a57919d33396651637b624a5b80ac, inode 9b4c3e44-5a3c-4ad0-950b-cbc0bbceeb3a, content type type_1) is not a new, live, or working version."
}

@freddyDOTCMS freddyDOTCMS moved this from Internal QA to Current Sprint Backlog in dotCMS - Product Planning Dec 27, 2024
@jdotcms
Copy link
Contributor

jdotcms commented Dec 27, 2024

Looking at the feedback

jdotcms added a commit that referenced this issue Dec 27, 2024
jdotcms added a commit that referenced this issue Dec 27, 2024
@jdotcms
Copy link
Contributor

jdotcms commented Dec 27, 2024

PR to fix the feedback

Note: on the postmans I have found a mistake, the query string is using lang=1 for setting the language id, it is "language" instead

@jdotcms
Copy link
Contributor

jdotcms commented Dec 27, 2024

Note1: now when trying to create a contentlet with a non existing language, it returns 400 bad request.
In addition the validation has been pushed on the validateContent on the ContentletAPI so any checkin with a non existing language will throw a DotState Exception

@jdotcms jdotcms moved this from Current Sprint Backlog to In Review in dotCMS - Product Planning Dec 27, 2024
@jdotcms jdotcms linked a pull request Dec 27, 2024 that will close this issue
@freddyDOTCMS freddyDOTCMS removed their assignment Jan 3, 2025
@jdotcms jdotcms moved this from In Review to Internal QA in dotCMS - Product Planning Jan 6, 2025
github-merge-queue bot pushed a commit that referenced this issue Jan 7, 2025
Adding QA feedback
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Internal QA
3 participants