Search code examples
node.jsloopbackjsstrongloop

Hide LoopBack PUT REST API method


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)
├── [email protected]
├── [email protected] (5a43a57)
├─┬ [email protected] (c945bd1)
│ └── [email protected]
├── [email protected]
├── [email protected] (5e25e21)
├── [email protected] (315d448)
├── [email protected] (aab3dbb)
├── [email protected]
└── [email protected] (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


Solution

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