# Creating a new resource with transifex\_api.Resource.create

**URL:** <https://community.transifex.com/t/creating-a-new-resource-with-transifex-api-resource-create/3235>\
**Category:** Developers\
**Tags:** api\
**Created:** [January 6, 2023, 1:49pm UTC](https://community.transifex.com/t/creating-a-new-resource-with-transifex-api-resource-create/3235 "2023-01-06T13:49:15Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![robert-weglarek](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.transifex.com/robert-weglarek/32/2496_2.png) [@robert-weglarek](https://community.transifex.com/u/robert-weglarek)\
**Post date:** [January 6, 2023, 1:49pm UTC](https://community.transifex.com/t/creating-a-new-resource-with-transifex-api-resource-create/3235/1 "2023-01-06T13:49:15Z")

</div>

Hi,

I’m trying to create a new resource like this:

`transifex_api.Resource.create(project=project, name="test", slug="test", i18n_format="PO")`

I’m struggling to figure out what should be the i18n\_format param. If I don’t provide it I get

> JsonApiException\_400\_invalid: (400, [{‘status’: ‘400’, ‘code’: ‘invalid’, ‘title’: ‘Field `i18n_format` is invalid’, ‘detail’: “‘i18n\_format’ is a required property”, ‘source’: {‘pointer’: ‘/data/relationships/i18n\_format’}}], \<Response [400]\>)

When provided I get

> JsonApiException\_400\_invalid: (400, [{‘status’: ‘400’, ‘code’: ‘invalid’, ‘title’: ‘Field `attributes` is invalid’, ‘detail’: “Additional properties are not allowed (‘i18n\_format’ was unexpected)”, ‘source’: {‘pointer’: ‘/data/attributes’}}, {‘status’: ‘400’, ‘code’: ‘invalid’, ‘title’: ‘Field `i18n_format` is invalid’, ‘detail’: “‘i18n\_format’ is a required property”, ‘source’: {‘pointer’: ‘/data/relationships/i18n\_format’}}], \<Response [400]\>)

What’s the correct method of creating it?

---

<div class="post-metadata">

**Author:** ![Sandy\_DLR](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.transifex.com/sandy_dlr/32/2498_2.png) [@Sandy\_DLR](https://community.transifex.com/u/Sandy_DLR)\
**Post date:** [January 9, 2023, 7:51pm UTC](https://community.transifex.com/t/creating-a-new-resource-with-transifex-api-resource-create/3235/2 "2023-01-09T19:51:45Z")

</div>

Hi Robert,

In the [create new resource endpoint](https://transifex.github.io/openapi/index.html#tag/Resources/paths/~1resources/post), i18n\_format is an object that contains another object called data. Inside the data object, there should be two key-value objects: Type and id. The type value should be “i18n\_formats”, and the id value should be the i18n file format code, which in your case is PO. Your payload should be something like the following:

```auto
{
  "data": {
    "type": "resources",
    "attributes": {
      "slug": "test",
      "name": "test"
    },
    "relationships": {
      "project": {
        "data": {
          "type": "projects",
          "id": "o:your_organization_slug:p:your_project_slug"
        }
      },
      "i18n_format": {
        "data": {
          "type": "i18n_formats",
          "id": "PO"
        }
      }
    }
  }
}

```

Let me know if the above info helps you solve your situation,

Regards,

Sandy
