Top Menu

Jump to content
Home
    Modules
      • Projects
      • Activity
      • Work packages
      • Gantt charts
      • Calendars
      • Team planners
      • Boards
      • News
    • Getting started
    • Introduction video
      Welcome to OpenProject Community
      Get a quick overview of project management and team collaboration with OpenProject. You can restart this video from the help menu.

    • Help and support
    • Upgrade to Enterprise edition
    • User guides
    • Videos
    • Shortcuts
    • Community forum
    • Enterprise support

    • Additional resources
    • Data privacy and security policy
    • Digital accessibility (DE)
    • OpenProject website
    • Security alerts / Newsletter
    • OpenProject blog
    • Release notes
    • Report a bug
    • Development roadmap
    • Add and edit translations
    • API documentation
  • Sign in
      Forgot your password?

      or sign in with your existing account

      Google

Side Menu

  • Overview
  • Activity
    Activity
  • Roadmap
  • Work packages
    Work packages
  • Gantt charts
    Gantt charts
  • Calendars
    Calendars
  • Team planners
    Team planners
  • Boards
    Boards
  • News
  • Forums

Content

General discussion
  1. OpenProject
  2. Forums
  3. General discussion
  4. Message boards

Message boards

Added by Tony Lancaster almost 7 years ago

Is it possible to add a message to the boards via the command line / rake tasks? I’ve been looking at the v3 API and it looks as though that functionality isn’t yet implemented.
Looking at the sql, it appears 2 tables are involved in this, although I’d prefer to let the application sort this out.

Thanks.


Replies (5)

RE: Message boards - Added by Oliver Günther almost 7 years ago

Hi Tony,

you’re right that boards are not yet contained in the APIv3 yet. To access it programatically, you don’t need a rake task to do that. You can execute a one-shot command with rails runner:

bundle exec rails runner "Message.create! board_id: "<id of the board you're submitting a message>, subject: 'My subject', content: 'My content'

Message.create! will raise an error to STDERR if if cannot save your message. It also sets the exit code to 1.

Best,
Oliver

RE: Message boards - Added by Tony Lancaster almost 7 years ago

Cheers for the reply, good to know it can be done this way.

After a little playing around with rvm to squish a couple of versioning errors, the command returns:

(erb):1:in `fetch’: Cannot load `Rails.application.database_configuration`: (KeyError)
key not found: “DATABASE_URL”

Any ideas?

RE: Message boards - Added by Oliver Günther almost 7 years ago

It doesn’t find your database settings.

You may need to prefix this with your environment that you’re running on. For example

RAILS_ENV=production bundle exec rails runner "Message.create! board_id: "<id of the board you're submitting a message>, subject: 'My subject', content: 'My content'

Best,
Oliver

RE: Message boards - Added by Tony Lancaster almost 7 years ago

That’s working now, much appreciated.

RE: Message boards - Added by Tony Lancaster almost 7 years ago

Can replies be added using something similar?

  • (1 - 5/5)
Loading...