Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7656953
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T12:54:04+00:00 2026-05-31T12:54:04+00:00

In my resource model I’ve got a subscription resource. It goes through lifecycle states

  • 0

In my resource model I’ve got a “subscription” resource. It goes through lifecycle states like “unsubscribed” -> “subscription pending” -> “subscribed” -> “unsubscription pending” -> “unsubscribed”.

To allow clients to subscribe or unsubscribe a subscription, I’m planning to expose two controller resources (called “sub” and “unsub”) for subscribing/unsubscribing the subscription, each accepting POST requests which will synchronously put the target subscription resource into the appropriate “pending” state, and asynchronously perform additional work to put the subscription into the “subscribed” or “unsubscribed” state.

I can think of a couple of ways for the client to designate the target subscription when making a POST request to “sub” or “unsub”. I could put the target subscription ID into the URI, like so:

/subscriptions/{subscription_id}/sub
or maybe
/sub/{subscription_id}

[Note: exposing the subscription ID in the URI would not present a security issue for my app.]

Or, I could make the subscription ID a POST param to:

/sub

Thoughts on which approach is preferable? If you prefer the URI approach, which URI style do you like better, and why?

Note: a subscription which has been unsubscribed could subsequently be resubscribed, so the “unsubscribe” action is not equivalent to deletion of the subscription resource.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T12:54:06+00:00Added an answer on May 31, 2026 at 12:54 pm

    I would make the ID a POST parameter to /subscription .

    Instead of having a separate /unsubscribe resource, I would send a DELETE request to /subscription (passing in the ID in the same way).

    I chose subscription instead of subscriber because there is ambiguity in subscriber as to whether you’re creating/deleting subscriptions or actual subscribers/users.

    EDIT – post-clarification.

    REST uses the verbs GET, POST, PUT, and DELETE. GET here doesn’t make sense for creating/updating. You don’t want DELETE because you want the resource to stay around. So I would recommend doing a POST for creating/starting a subscription and a PUT for modifying/unsubscribing a subscription. It’s a slight misuse of the PUT verb but I think it fits your case a little better than the alternatives.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have model called Search and a resource named :search . I'd like to
So I created some rspec_scaffold for an Exercise model and added map.resource :exercises to
I rewrite the sales/order_collection Model or, perhaps, correctly said the Resource. I did that
1- Resource files suppose to be added on adding some resource in application like
Using a restful resource in Rails, I would like to be able to insert
I have a class thats created as a resource: <Window.Resources> <Model:MyModel x:Key=model /> </Window.Resources>
In my model I have class Alias include DataMapper::Resource belongs_to :user property :id, String,
I have this model class User include DataMapper::Resource include BCrypt property :id, Serial property
I have an model (User) which has a has_many relationship to another model (Resource).
How do I get the path to a resource in the model? I need

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.