[SOLVED] Transifex API v3 with Python SDK: 'relationships is a required property'

In my code I am trying to initialize a new resource with something along the lines of:

from transifex.api import transifex_api as tx_api

resource_name = "My Resource"
resource_slug = "my_resource"
tx_api.Resource.create(name=resource_name, slug=resource_slug)

and this throws a JsonApiException with error code 400 whose detail reads 'relationships is a required property'. I am not sure I understand why. Any clue?

Hello @MrNycticorax ,

Thank you for reaching out to the Transifex community.

Regarding your issue can you please check the following link?

Also regarding the creation of the resource I see that your variable is resourcel_slug but you used it in the next line of code as resource_slug
So, what about the following example?

resource = transifex_api.Resource.create(
        project=project,
        i18n_format=transifex_api.I18nFormat(id="FILELESS"),
        name=resource_name,
        slug=resource_slug,
    )

Instead of the id="FILELESS" you can use any other i18n type is acceptable eg. id="PO"

Looking forward to your response.

Kind regards,
Panagiotis

Thank you very much @Panagiotis_Kavrakis, adding the missing i18n_format and project keys did the trick!

By the way there is a Discourse plugin supporting the “Mark as solved” feature. This might be useful!

Thank you for your response @MrNycticorax !

We will check this out.

Have a nice day!

Kind regards,
Panagiotis

1 Like