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

REST API issue with response #7639

Closed
2 tasks done
VygantasOBDeleven opened this issue May 13, 2022 · 1 comment
Closed
2 tasks done

REST API issue with response #7639

VygantasOBDeleven opened this issue May 13, 2022 · 1 comment
Labels
duplicate Similar issue or pull request already exists. enhancement Adding or requesting a new feature.
Milestone

Comments

@VygantasOBDeleven
Copy link

VygantasOBDeleven commented May 13, 2022

Describe the issue

According to documentation of POST /api/translations/(string:project)/(string:component)/(string:language)/units/ endpoint, we should retrieve information about newly created unit. Instead, we get response of translation itself. There is no way of knowing newly created resource Id. Currently received response:

{
    "language": {
        "code": "en",
        "name": "English",
        "plural": {
            "id": 143,
            "source": 0,
            "number": 2,
            "formula": "n != 1",
            "type": 1
        },
        "aliases": [
            "en_en",
            "base",
            "source",
            "enp",
            "eng"
        ],
        "direction": "ltr",
        "web_url": "--/languages/en/",
        "url": "--/languages/en/",
        "statistics_url": "--/languages/en/statistics/"
    },
    "component": {
        "name": "--",
        "slug": "--",
        "id": 9,
        "source_language": {
            "code": "en",
            "name": "English",
            "plural": {
                "id": 143,
                "source": 0,
                "number": 2,
                "formula": "n != 1",
                "type": 1
            },
            "aliases": [
                "en_en",
                "base",
                "source",
                "enp",
                "eng"
            ],
            "direction": "ltr",
            "web_url": "--/languages/en/",
            "url": "--/languages/en/",
            "statistics_url": "--/en/statistics/"
        },
        "project": {
            "name": "--",
            "slug": "-",-
            "id": 1,
            "web": "--",
            "web_url": "--",
            "url": "--",
            "components_list_url": "--/components/",
            "repository_url": "--/repository/",
            "statistics_url": "--/statistics/",
            "changes_list_url": "--/changes/",
            "languages_url": "--/languages/",
            "translation_review": true,
            "source_review": true,
            "set_language_team": true,
            "instructions": "",
            "enable_hooks": false,
            "language_aliases": ""
        },
        "vcs": "local",
        "repo": "local:",
        "git_export": "--",
        "branch": "main",
        "push_branch": "",
        "filemask": "*.json",
        "template": "en.json",
        "edit_template": true,
        "intermediate": "",
        "new_base": "",
        "file_format": "json",
        "license": "",
        "license_url": null,
        "agreement": "",
        "web_url": "--",
        "url": "--",
        "repository_url": "--/repository/",
        "translations_url": "--/translations/",
        "statistics_url": "--/statistics/",
        "lock_url": "--/lock/",
        "links_url": "--/links/",
        "changes_list_url": "--/changes/",
        "task_url": null,
        "new_lang": "add",
        "language_code_style": "",
        "push": "",
        "check_flags": "",
        "priority": 100,
        "enforced_checks": [],
        "restricted": false,
        "repoweb": "",
        "report_source_bugs": "",
        "merge_style": "rebase",
        "commit_message": "Translated using Weblate ({{ language_name }})\n\nCurrently translated at {{ stats.translated_percent }}% ({{ stats.translated }} of {{ stats.all }} strings)\n\nTranslation: {{ project_name }}/{{ component_name }}\nTranslate-URL: {{ url }}",
        "add_message": "Added translation using Weblate ({{ language_name }})\n\n",
        "delete_message": "Deleted translation using Weblate ({{ language_name }})\n\n",
        "merge_message": "Merge branch '{{ component_remote_branch }}' into Weblate.\n\n",
        "addon_message": "Update translation files\n\nUpdated by \"{{ addon_name }}\" hook in Weblate.\n\nTranslation: {{ project_name }}/{{ component_name }}\nTranslate-URL: {{ url }}",
        "pull_message": "Translations update from {{ site_title }}\n\nTranslations update from [{{ site_title }}]({{ site_url }}) for [{{ project_name }}/{{ component_name }}]({{url}}).\n\n{% if component_linked_childs %}\nIt also includes following components:\n{% for linked in component_linked_childs %}\n* [{{ linked.project_name }}/{{ linked.name }}]({{ linked.url }})\n{% endfor %}\n{% endif %}\n\nCurrent translation status:\n\n![Weblate translation status]({{widget_url}})\n",
        "allow_translation_propagation": true,
        "manage_units": true,
        "enable_suggestions": true,
        "suggestion_voting": false,
        "suggestion_autoaccept": 0,
        "push_on_commit": true,
        "commit_pending_age": 24,
        "auto_lock_error": true,
        "language_regex": "^[^.]+$",
        "variant_regex": "",
        "addons": [],
        "is_glossary": false,
        "glossary_color": "silver"
    },
    "language_code": "en",
    "id": 34,
    "filename": "en.json",
    "revision": "0967ef424bce6791893e9a57bb952f80fd536e93,0967ef424bce6791893e9a57bb952f80fd536e93",
    "web_url": "--/en/",
    "share_url": "--/en/",
    "translate_url": "--/en/",
    "url": "--/en/",
    "is_template": true,
    "is_source": true,
    "total": 1,
    "total_words": 4,
    "translated": 1,
    "translated_words": 4,
    "translated_percent": 100.0,
    "fuzzy": 0,
    "fuzzy_words": 0,
    "fuzzy_percent": 0.0,
    "failing_checks": 0,
    "failing_checks_words": 0,
    "failing_checks_percent": 0.0,
    "have_suggestion": 0,
    "have_comment": 0,
    "last_change": null,
    "last_author": null,
    "repository_url": "--/en/repository/",
    "file_url": "--/en/file/",
    "statistics_url": "--/en/statistics/",
    "changes_list_url": "--/en/changes/",
    "units_list_url": "--/en/units/"
}

I already tried

  • I've read and searched the documentation.
  • I've searched for similar issues in this repository.

How do you run Weblate?

Docker container

@nijel nijel added enhancement Adding or requesting a new feature. duplicate Similar issue or pull request already exists. labels May 13, 2022
@nijel nijel added this to the 4.13 milestone May 13, 2022
@nijel nijel added this to To do in API improvements via automation May 13, 2022
@nijel
Copy link
Member

nijel commented May 13, 2022

Duplicate of #7603

API improvements automation moved this from To do to Done May 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate Similar issue or pull request already exists. enhancement Adding or requesting a new feature.
Projects
Status: Done
Development

No branches or pull requests

2 participants