Minimal JSON for contentful-import

Currently I am working on getting custom data into a format, which I can import easily into Contentful. There is a tool called contentful-import, which I can use to import stuff, but it needs a certain format. To get to the minimal format of such a file, I exported a space and removed everything which wasn't needed. Trial and error is your friend! Now I can use this file as a "spec" whle developing.

{
  "contentTypes": [
    {
      "sys": {
        "id": "post"
      },
      "name": "Post",
      "fields": [
        {
          "id": "title",
          "name": "Title",
          "type": "Symbol"
        },
        {
          "id": "body",
          "name": "Body",
          "type": "Text"
        }
      ]
    }
  ],
  "entries": [
    {
      "sys": {
        "id": "<unique_id_here>",
        "publishedVersion": 1,
        "contentType": {
          "sys": {
            "id": "post"
          }
        }
      },
      "fields": {
        "title": {
          "en-US": "My Cat"
        },
        "body": {
          "en-US": "This is a post about my cat."
        }
      }
    }
  ],
  "assets": [
    {
      "sys": {
        "publishedVersion": 1
      },
      "fields": {
        "title": {
          "en-US": "my cat"
        },
        "description": {
          "en-US": "a picture of my cat"
        },
        "file": {
          "en-US": {
            "url": "//example.com/my_cat.jpg",
            "fileName": "my_cat.jpg",
            "contentType": "image/jpeg"
          }
        }
      }
    }
  ]
}

Related Posts