0

How do I hide the PUT REST API method in LoopBack? I've been able to successfully hide many other methods, but not the PUT method.

> $ slc -v
strongloop v2.10.3 (node v0.10.35)
├── strong-arc@1.1.0
├── strong-build@1.0.3 (5a43a57)
├─┬ strong-supervisor@1.4.1 (c945bd1)
│ └── strong-agent@1.3.2
├── node-inspector@0.7.4
├── strong-deploy@1.1.4 (5e25e21)
├── strong-pm@1.7.2 (315d448)
├── strong-registry@1.1.4 (aab3dbb)
├── nodefly-register@0.3.3
└── generator-loopback@1.7.3 (9dc370f)

Hiding methods:

module.exports = function(Studio) {
    var isStatic = true;
    Studio.disableRemoteMethod('deleteById', isStatic); // DELETE /Studios/{id}
    Studio.disableRemoteMethod('create', isStatic); // POST /Studios
    Studio.disableRemoteMethod('upsert', isStatic); // PUT /Studios
    Studio.disableRemoteMethod('updateAll', isStatic); // POST /Studios/update
    Studio.disableRemoteMethod('updateAttributes', isStatic); // PUT /Studios/{id} *What is this supposed to be?*
};

How do I hide PUT /Studios/{id}. The documentation suggests that it is updateAttributes, but I've tried every combination I possibly could without success. http://docs.strongloop.com/display/public/LB/Exposing+models+over+REST#ExposingmodelsoverREST-HidingmethodsandRESTendpoints

duffn
  • 3,690
  • 8
  • 33
  • 68

1 Answers1

2

i think you have to use isStatic = false for method "updateAttributes"...

AndreF
  • 36
  • 1
  • 1
  • That's right! I completely missed the isStatic difference for prototypes. Thanks. – duffn Mar 02 '15 at 16:37
  • This works for my project based on LoopBack2.5: `Model.sharedClass.find('updateAttributes', false).shared = false;` – AndreF Mar 02 '15 at 16:42