I have managed to access a static url but when it comes to accessing an existing collection in mongodb (2.6) through a browser (e.g., http://0.0.0.0:8080/test/test) it returns a 404. Anybody knows if I have to add anything to the default configuration.yml to activate mongo access?
Thanks for help!!
First make sure it is RESTHeart responding you request:
if it is running on your pc, try 127.0.0.1:8080/test/test (not 0.0.0.0)
Also note that in case of 404, you should get a hal+json document with a "message" property (with somenthing like "the db test does bot exist").
If it is restheart, then either the db "test" or the collection "test/test" does not exist an you have to create them first.
If restheart coudn't connect with mongodb you would get "400 Internal Server Error" response code.
Finally I managed to find what the problem was by myself. I post the answer in case it's helpful for somebody else. Thanks Andrea for the help in any case :)
In the static-resources-mounts I had "where: /", which seemed to collide with the mongo-mounts default own "where: /". By changing either where value the access to mongodb retrieves a correct hal+json.
Related
I have done everything needed to setup webservices on my moodle 3.11 instance, including roles/capabilities/user. However sending a test request always gives {
"exception": "dml_missing_record_exception",
"errorcode": "invalidrecord",
"message": "Can't find data record in database table external_functions."
}
The URL to access it is of the format https:///moodle/webservice/rest/server.php?wsfunction=core_user_create_user&service=mymoodleusermanage&moodlewsrestformat=json&users[0][username]=ABC&users[0][firstname]=VPTest&users[0][lastname]=None&users[0][email]=mail#xxx.com&users[0][password]=xxxxx&users[0][auth]=manual&wstoken=xxxxxxxxxxxxxx
The service parameter is correctly set to the shortname of the service. Does the service have to be defined anywhere additionally apart from Site Administration->Server->Web Services->External Services->Custom Services
Thanks for any help that can be given
The answer is very simple - you are trying to call a non-existent webservice function (hence the error message about being unable to find the database record for the function in the external_functions database table).
If you look in the Moodle code: https://github.com/moodle/moodle/blob/master/lib/db/services.php#L1717 you will see that the function is called core_user_create_users - with an "s" at the end of it.
If you add that extra "s" into the URL parameters you are using, then it should work.
https:///moodle/webservice/rest/server.php?wsfunction=core_user_create_user&service=mymoodleusermanage&moodlewsrestformat=json&users[0][username]=ABC&users[0][firstname]=VPTest&users[0][lastname]=None&users[0][email]=mail#xxx.com&users[0][password]=xxxxx&users[0][auth]=manual&wstoken=xxxxxxxxxxxxxx
you must change username all character small letter [username]=ABC like this [username]=abc and add s wsfunction=core_user_create_users
I am working on a restful service in golang using chi. I am trying to create a route as below
r.Mount("/api/dest", router.NewDestRouter(chi.NewRouter(), destSrv).InitRoutes())
func (dr *DestRouter) InitRoutes() http.Handler {
dr.router.Post("/{number}/product?version={v}", handlers.HandleProduct(dr.dest))
return dr.router
}
But I try to hit this endpoint via post man I get a 404 not found
http://localhost:8345/api/dest/1235abc/product?version=1
May I know the issue here?
As #mkopriva mentioned, simply use r.URL.Query().Get("version") to get the query parameter.
Met this issue, found status 404, for your situation, only go with /{number}/product, do not need to add the content ?version={v}, chi only match with the path, and then use r.URL.Query().Get("version") to get the query parameters, it will work.
Calling the discoverAndAddAccount method via the API Explorer returns the following error:
HTTP Status 500 - message=General IO error while proxying request; errorCode=006003; statusCode=500.
Can anybody help me identify what I missed?
Did you pass the private key password and SSL key of certificate in the API explorer?
https://developer.intuit.com/docs/0020_customeraccountdata/007_firstrequest
Please verify if you are passing a correct request body
<InstitutionLogin xmlns="http://schema.intuit.com/platform/fdatafeed/institutionlogin/v1">
<credentials>
<credential>
<name>Banking Userid</name>
<value>direct</value>
</credential>
<credential>
<name>Banking Password</name>
<value>anyvalue</value>
</credential>
</credentials>
</InstitutionLogin>
Doc Ref - https://developer.intuit.com/docs/0020_customeraccountdata/customer_account_data_api/0020_api_documentation/0020_discoverandaddaccounts#Discover_and_Add_Request
Also refer the following doc for correct userid and pwd while testing with dummy CC_Bank>
https://developer.intuit.com/docs/0020_customeraccountdata/customer_account_data_api/testing_calls_to_the_api
If it doesn't resolve the issue, then please raise a support ticket.
Link - http://developer.intuit.com/Support/Incident
Thanks
EDIT { Adding Snapshot }
'DiscoverAndAddAccounts' call is working fine for me. Can you share the screenshot. I can look into this and let u know if I get something.
Thanks
I am working with REST in Yii. Therefore I use yiirestful plugin and Backbone.JS. At the moment I am perfectly able to do POST and GET request throughout REST. But when I want to update a record I alway get an 403 forbidden error. I shall explain what i've tried and how:
First of all I am saving my collection in Backbone like this:
Backbone.sync('update', this.collection);
Now I don't for sure if that's going to work but the fact is that any PUT request get's an 403.
Secondly, because I am working in a module I adjusted the URLmanager rules like this:
'contentManagement/api/<controller:\w+>'=>array('contentManagement/<controller>/restList', 'verb'=>'GET'),
'api/<controller:\w+>'=>array('<controller>/restList', 'verb'=>'GET'),
'api/<controller:\w+>/<id:\w+>'=>array('<controller>/restView', 'verb'=>'GET'),
'api/<controller:\w+>/<id:\w+>/<var:\w+>'=>array('<controller>/restView', 'verb'=>'GET'),
array('contentManagement/<controller>/restCreate', 'pattern'=>'contentManagement/api/<controller:\w+>', 'verb'=>'POST'),
array('<controller>/restUpdate', 'pattern'=>'contentManagement/api/<controller:\w+>/<id:\d+>', 'verb'=>'PUT'),
array('<controller>/restUpdate', 'pattern'=>'contentManagement/api/<controller:\w+>/<id:\d+>', 'verb'=>'PUT'),
array('<controller>/restDelete', 'pattern'=>'api/<controller:\w+>/<id:\d+>', 'verb'=>'DELETE'),
array('<controller>/restCreate', 'pattern'=>'contentManagement/api/<controller:\w+>', 'verb'=>'POST'),
array('<controller>/restCreate', 'pattern'=>'contentManagement/api/<controller:\w+>/<id:\w+>', 'verb'=>'POST'),
It could be the case that this causes the problem. But I am not very digged in to this rules.. I did the same as i did by the POST request but whatever I try it still gives the 403.
Thirdly i'll provide my request information:
PUT http://pimtest.php/Yii/trackstar/contentManagement/api/SidebarWidgetsUsed/
403 Forbidden
38ms
I think a id is needed after this url but when I provide an id in the data that should be enough to let backbone recognize it's about an PUT request / update request.
I have no clue where to look further in my code.. I understand it's a complicated story so any minimal advice is appreciated!
Greetz,
You have two (identical) rules that apply to PUT, and as you say, they require an ID. Without an ID, none of the rules will match for a PUT request.
Either provide an ID, or modify the rule to not require an id, e.g.:
array('<controller>/restUpdate', 'pattern'=>'contentManagement/api/<controller:\w+>', 'verb'=>'PUT'),
In any case, as you're not using id, I'm not sure why it's in the rule to start?
I did everything, i think:
deleted windows/Temp
soap.wsdl_cache_enabled=0 in php.ini and restarted apache
ini_set("soap.wsdl_cache_enabled", "0"); in handleWDSL, handleSOAP and clientAction!
what else? still getting:
Message: Function ("arrays_work") is not a valid method for this service
That is the new function I added to the service. Also, if I change oldones, nothing happens (for instance, adding functionality to access db).
please...
any clues?
This was solved and in this case was related to other thing: the uri for the wdsl was pointing to an oldone... sorry..