Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generate Announcement from CLI/OCC #147

Open
rijmenantspj opened this issue Mar 10, 2019 · 4 comments · May be fixed by #779
Open

Generate Announcement from CLI/OCC #147

rijmenantspj opened this issue Mar 10, 2019 · 4 comments · May be fixed by #779

Comments

@rijmenantspj
Copy link

Steps to reproduce

N/A

Expected behaviour

As a Request for Enhancement/Feature Request:
As a Nextcloud admin, it would be helpful to be able to create announcements from the command line (for example via Nextcloud's OCC).

Actual behaviour

Announcements can, to my understanding, only be created from the Announcement Center.

Server configuration

Operating system: Ubuntu 18.04.2 LTS (Bionic Beaver)

Web server: Apache 2.4.29

Database: MariaDB 10.1.38

PHP version: PHP 7.2.15

Nextcloud version: 15.0.5

Where did you install Nextcloud from: Archive File (see https://nextcloud.com/install/#instructions-server)

Signing status: N/A

List of activated apps: N/A

Nextcloud configuration: N/A

Are you using an external user-backend, if yes which one: N/A

Client configuration

Browser: N/A

Operating system: N/A

Logs

N/A

Nextcloud log (data/owncloud.log)

N/A

Browser log

N/A

@dhelonious
Copy link

Any news on this? This feature would be quite helpful in federated clusters and for any kind of automation involving downtimes and other changes which should be announced properly.

@nickvergessen
Copy link
Member

https://github.com/nextcloud/announcementcenter#%EF%B8%8F-state-of-maintenance

If you manage to run a federated cluster maybe you could also sponsor a feature development?

@dhelonious
Copy link

Thanks for the info, I totally overlooked that... I currently evaluate whether Nextcloud is feasable for our use case with up to 30k users. I imagine the announcement center being really useful for things like ToS and maintenance announcements, so one has not to build and rely on other communication infrastructures. If we want to move on with this project, we will approach your company and we will definately consider your suggestion!

@mwinkens
Copy link

mwinkens commented Mar 19, 2024

as a workaround you might use the rest api here and post at /api/v1/announcements, but you'll need an admin session.
But I agree, a CLI would be nice, I'll check this out next PR!

According to https://docs.nextcloud.com/server/latest/developer_manual/server/externalapi.html#authentication-basics this should work

curl -X POST \
  -H "Content-Type: application/json" \
  --header "OCS-APIRequest: true" \
  -u adminUser:appToken \
  -d '{
    "subject": "Your Subject",
    "message": "Your Markdown Body",
    "plainMessage": "Your Plain Body",
    "groups": ["group1", "group2"],
    "activities": true,
    "notifications": true,
    "emails": true,
    "comments": true,
    "banner": true,
    "scheduleTime": null,
    "deleteTime": null
  }' \
  https://127.0.0.1/ocs/v2.php/apps/announcementcenter/api/v1/announcements?format=json

You might need to remove scheduleTime and deleteTime in your version

I tested this:

{"ocs":{"meta":{"status":"ok","statuscode":200,"message":"OK"},"data":{"id":24,"author_id":"nextcloud27","author":"nextcloud27","time":1710863883,"subject":"Your Subject","message":"Your Markdown Body","groups":[{"id":"everyone","name":"everyone"}],"comments":0,"schedule_time":null,"delete_time":null,"notifications":true}}}

This was referenced Mar 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants