Content import 400 error

Hi! After synchronizing schemas from the cloud to my local, I try to import content, but got this error

The import helper is just not designed for singletons, because it tries to create a new content item, which is not possible.

1 Like

How I can import singleton content ?

Either you wait for a fix, or you write a custom importer or you try the key field argument (See --help)

Do you mean command like that ?

./sq content import t t_2022-04-20-07-21-24.json --format=JSON --fields=every single schema element comma separated ?

I think the command supports a key field, when a key field is used it tries to identity a content by a data field. So if you know, that one field does not change, you could use that.

Should be called key

So I have a list from 2000 elements, schemas was successfully exported.
Have no idea which of them is a key.

The key is something per content item. Lets say you have a list of blog posts, then the slug is a good candidate for a key. So when you import something it tries to find the blog post with the same slug as the current record and makes an update. Otherwise it creates a new item.

Okay, Sebastian, but can you please explain in one real app from my apps list, and the other apps I will do with myself?

I don’t get this. It is not a technical thing, more a business decision what a good key field is.

No. No finding keys. Move project from cloud to local

Then I would just use the sync command or I would use the backup feature.

It doesnt throw any error, but doesnt add anything

What exactly have you done? Can you send me your backup folder and the commands you have tried?

./sq config use admin-splytz
./sq sync new splytz
vim splytz/__app.json -> Change contributor
./sq config use splytz-admin
./sq sync in splytz
And result I the previous screenshot

Then it works by design

  • new creates a new, empty folder. The typical use case is for CI processes where the schemas are entirely managed in code and part of a repository.
  • out makes an “export” to a folder.
  • in makes an “import” from a folder.

Okay.
./sq config use admin-test
./sq sync out test-admin

Successfully folder was created

./sq config use test-dev
./sq sync in test-admin

Your credentials are not correct.

Yes, miss to add the last parameter. But when I do sync, the content is empty.
Can we have a short video call? I will share my screen. to be more effective.

Sure. You can use this link: https://calendly.com/squidex-meeting/30min

But not today.

1 Like