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 8334029
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T03:12:57+00:00 2026-06-09T03:12:57+00:00

So say I have a RESTFul API that has the standard GET , POST

  • 0

So say I have a RESTFul API that has the standard GET, POST, PUT, and DELETE methods on it, but I also have other methods on it that are custom to specific object types, and on top of that I require a security token.

so a URL for this service might look like this:

GET/PUT/POST/DELETE http://sample.com/api/User/123?token=ABCDEF1234

and

GET http://sample.com/api/User/GetUsersByStatus?token=ABCDEF1234&param1=blah&param2=foo

or

POST http://sample.com/api/User/DoSomethingCrazy?token=ABCDEF1234

where the last two do some custom functionality. Maybe it’s something to reset a password, or maybe it’s something to clone a user and return the record, I don’t know. Just custom “stuff”.

What is the best-practice way to handle this with Angular? I’ve seen the $resource utility, but it seems to only be for the standard REST methods, and I’m not sure how to extend that in a way that the next Angular developer will understand.

  • 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-06-09T03:12:59+00:00Added an answer on June 9, 2026 at 3:12 am

    If I’m understanding you correctly, what I believe you are asking is how to make the resource methods automatically include your token??? If this is correct, then you can do this a couple of ways. First, you can just extend the predefined resource methods and bake in params that will be applied each call or you can define your own methods.

    Also, when you call a method, if parameters have not been prequalified, they will end up on the querystring.

    Below is sample code I wrote for a cakephp implementation. I’m passing in action for each of the predefined methods and my own initialize method.

    
    angular.module('myApp.cakephp.services', ['ngResource']).
      factory('CommentSvc', function ($resource) {
            return $resource('/cakephp/demo_comments/:action/:id/:page/:limit:format', { id:'@id', 'page' : '@page', 'limit': '@limit' }, {
              'initialize' : { method: 'GET', params: { action : 'initialize', format: '.json' }, isArray : true },
              'save': { method: 'POST', params: { action: 'create', format: '.json' } },
              'query' : { method: 'GET', params: { action : 'read', format: '.json' } , isArray : true },
              'update': { method: 'PUT', params: { action: 'update', format: '.json' } },
              'remove': { method: 'DELETE', params: { action: 'delete', format: '.json' } } 
            });
      })
    

    hope this helps

    –dan

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

Sidebar

Related Questions

Let's say I have the URI for a RESTful or other contract-less API. Is
Let's say I have a class called Store that has many Employees. My RESTful
Let's say I have a RESTful, hypertext-driven service that models an ice cream store.
Let's say I have a RESTful API running on a server somewhere, as well
So I have a RESTful api module which has several resources. I am trying
Say I have a Telerik MVC Grid, AJAX bound and I want to put
Say I have a SSI script that uses exec, or a PHP script that
I have a web app that has lots of pages with a URL of
I am trying to implement a RESTful API in which I have to upload
So let's say I have two :has_and_belongs_to_many models that are joined by a simple

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.