A simple example of uploading to a community from CLI

Dear All,

Would it be possible to provide a simple example of how to upload a document to a specific community? I ran the older “upload.py” test which works fine, but it doesn’t target a community. The access token is apparently valid. I’m just not sure how to construct the URL and other elements needed for the HTTP request. Thank you!


1 Like

the upload to a community is a multi-step process, you cannot do it with one request only.
This is because it goes through a review process, where the community owners/managers/curators receive a new request to include the record in their community through a review.

Here the steps:

  1. Create a new draft
  2. Create a new unsubmitted review, with the community id
  3. Submit the review

This should work.

Thank you so much for your reply. Yes, the review process is well designed – I was just wondering if it applies to ALL uploads to the community, including by ones done by the actual owners. My theory was is that since the owners already have all decision powers, it was possible to add material directly.
Thank you!


Yes, you can do that: you still go through a review process, but the request is automatically and immediately accept it and your record is immediately added.
You can change the settings of your community to automatically accept inclusions by owners/managers/curators.

To do, go to your community → Settings → Curation Policy:

You can try it out here in our demo instance if you prefer.

This is super helpful, thank you! I was already using a test community I created, for my practice with the REST API. I’ll five it another spin.

Thanks again,

Thanks again – I tried this setting. It works in the web UI. Question is, what is the correct URL to point to, when uploading to a specific community in this manner, from CLI? I couldn’t find info in the docs.

Best regards,

What do you mean exactly? The URLs are the same as the one described above.
The auto-inclusion setting is taken into account when you submit a review.

Hi @mpotekhi , Days ago I stumbled upon this

extending the capabilities of the invenio command line:

(3.9.18/envs/rdmfull) [rdm@zenodo-dev rdm]$ invenio tuw --help
Usage: invenio tuw [OPTIONS] COMMAND [ARGS]...

  Utility commands for InvenioRDM.

  --help  Show this message and exit.

  drafts   Management commands for creation and publication of drafts.
  files    Management commands for files.
  records  Management commands for records.
  reports  Commands for generating reports.
  search   Management commands for search indices.
  users    Management commands for users.

I am trying to use this to migrate contents from an old repository,
using invenio tuw drafts create

I tried this a little and looks useful. Maybe these or similar utilities could be integrated in the forecoming 12v release?

That’s good to know, thanks. I was only starting to look at that.

Ah, OK. I’ll be looking into this.

I do not have that selection “Allow curators, managers and owners to publish without review”.
Is that possible in v11.0 or it is new in v12?

Yes, it looks like that it has been introduced in InvenioRDM v12, which will be released soon.