# Call API Methods Problem

**URL:** <https://forums.rocket.chat/t/call-api-methods-problem/2461>\
**Category:** Development\
**Created:** [November 14, 2018, 1:11pm UTC](https://forums.rocket.chat/t/call-api-methods-problem/2461 "2018-11-14T13:11:05Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![pombaer](https://avatars.discourse-cdn.com/v4/letter/p/d26b3c/32.png) [@pombaer](https://forums.rocket.chat/u/pombaer)\
**Post date:** [November 14, 2018, 1:11pm UTC](https://forums.rocket.chat/t/call-api-methods-problem/2461/1 "2018-11-14T13:11:05Z")

</div>

Maybe this is a problem from Hubot. I am Using 0.71.1 of Rocketchat (dockerimage) and Hubot 2.19.0.  
I am programming API function, the following Function is working, this simply displays the Verison Informations usw:

robot.respond(/api testfunction1$/i, function(res) {  
robot.adapter.callMethod(‘getServerInfo’)  
.then(function(result) {  
console.log(result)  
})  
.catch(function(error) {  
console.log(error)  
})

Running this functions makes a Log entry i Rocketcaht like:  
Meteor ➔ method getServerInfo -\> …

Calling the following function returns a 404 Error “Method not found”:

robot.respond(/api testfunction2$/i, function(res) {  
robot.adapter.callMethod(‘adminRooms’, ‘general’, [‘c’, ‘d’, ‘p’], 50)  
.then(function(result) {  
res.reply(“Success”)  
console.log(result)  
})  
.catch(function(error) {  
res.reply(“Error”)  
console.log(error)  
})  
})

No LOG Method occures.

If i open “Administration” - “Rooms” in Rocketchat the following LOG Entry occures:

Meteor ➔ publish adminRooms -\>

The difference to the first function is the “publish” instead of the “method” in the LOG Entry, how do i have to call the “adminRooms” Method/function in hubot to get a list of all Rooms?

---

<div class="post-metadata">

**Author:** ![pombaer](https://avatars.discourse-cdn.com/v4/letter/p/d26b3c/32.png) [@pombaer](https://forums.rocket.chat/u/pombaer)\
**Post date:** [November 15, 2018, 6:36am UTC](https://forums.rocket.chat/t/call-api-methods-problem/2461/2 "2018-11-15T06:36:48Z")

</div>

Tried it out with Hubot 3.1.1, same result.

Error in Hubot Log:

[Thu Nov 15 2018 07:30:08 GMT+0100 (CET)] ERROR [fullUserData] Error: { isClientSafe: true,  
error: 404,  
reason: ‘Method ‘fullUserData’ not found’,  
message: ‘Method ‘fullUserData’ not found [404]’,  
errorType: ‘Meteor.Error’ }  
{ isClientSafe: true,  
error: 404,  
reason: ‘Method ‘fullUserData’ not found’,  
message: ‘Method ‘fullUserData’ not found [404]’,  
errorType: ‘Meteor.Error’ }  
[Thu Nov 15 2018 07:30:08 GMT+0100 (CET)] INFO [sendMessage] Calling (async): [{“msg”:“Error”,“bot”:{“i”:“js.SDK”},“rid”:“7B7APsSMiPeocGLWAa3cHyNGiHiQaCgcHW”}]

Rocketchat has no Log information. I do not understand why “Hubot” returns 404 without a corresponding message in Rocketchat, should not Rocketchat log an error that the called message is not found? If i run other functions like “getServerInfo” with wrong Parameters i get a Rockerchat LOG Entry too.
