# REST API vs. the Ruby API

**URL:** <https://meta.discourse.org/t/rest-api-vs-the-ruby-api/108654>\
**Category:** Development\
**Created:** [February 8, 2019, 2:34am UTC](https://meta.discourse.org/t/rest-api-vs-the-ruby-api/108654 "2019-02-08T02:34:52Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![simon](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/simon/32/339122_2.png) [@simon](https://meta.discourse.org/u/simon)\
**Post date:** [February 9, 2019, 4:28am UTC](https://meta.discourse.org/t/rest-api-vs-the-ruby-api/108654/4 "2019-02-09T04:28:55Z")

</div>

Since I posted about reopening the module, I figured I should try it out with your method to make sure it’s possible. Adding this code to a file and running it from the command line is working for me.

```plaintext
require 'discourse_api'

module DiscourseApi
  module API
    module Notifications
    	def set_group_user_notification_level group, user_id, notification_level
    		post("/groups/#{group}/notifications?user_id=#{user_id}&notification_level=#{notification_level}")
    	end
    end
  end
end

client = DiscourseApi::Client.new("http://localhost:3000")
client.api_key = "<your-api-key>"
client.api_username = "system"

response = client.set_group_user_notification_level 'running', 1, 3

puts "Response: #{response}"

```

---

_[View the full topic](https://meta.discourse.org/t/rest-api-vs-the-ruby-api/108654)._
