Sanity check is done in OM with unit tests On Sun, 19 Apr 2020 at 19:01, Daniel Baker <[email protected]> wrote:
> Nice thing about the curl examples is they can be one liners > performed at the command line and provide a fast test /sanity check. > On 19/04/2020 11:49, Maxim Solodovnik wrote: > > I'm not curl expert > > You can dump both java and php requests to get curl examples :) > > On Sun, Apr 19, 2020, 17:38 Daniel Baker <[email protected]> > wrote: > >> Nice, do you think you have time to test some others? We would >> like to see your results from *add *file and *kick *: >> >> >> https://openmeetings.apache.org/openmeetings-webservice/apidocs/org/apache/openmeetings/webservice/FileWebService.html#add(java.lang.String,org.apache.openmeetings.db.dto.file.FileItemDTO,java.io.InputStream) >> >> >> https://openmeetings.apache.org/openmeetings-webservice/apidocs/org/apache/openmeetings/webservice/RoomWebService.html#kick(java.lang.String,long,java.lang.String,java.lang.String) >> >> >> >> >> On 19/04/2020 07:34, K. Kamhamea wrote: >> >> This is my complete test case so far: >> >> This is my python script to test the url >> >> import requests >> def send_http_request(): r = >> requests.get(url='https://localhost:5443/openmeetings/services/user/login?user=admintest&pass=%211Qay', >> verify=False) >> print ("Status code:\t{}".format(r.status_code)) >> print ("Headers:\t{}".format("\n\t\t".join(r.headers))) >> print ("Content:\t{}".format(r.text[:100])) #if __name__ == "__main__": >> send_http_request() >> print ("Ready now!") >> >> These are my *curl commands* >> >> curl -k --user-agent "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT >> 5.0)" -H "Content-Type: application/json" -H "Accept: application/xml" -X >> get ' >> https://localhost:5443/openmeetings/services/user/login?user=admintest&pass=!1Qay >> ' >> >> or URL encoded >> >> curl -k -H "Content-Type: application/json" -X get ' >> https://localhost:5443/openmeetings/services/user/login?user=admintest&pass=%211Qay >> ' >> >> This is the line I put into my *Firefox Browser* >> >> >> https://localhost:5443/openmeetings/services/user/login?user=admintest&pass=%211Qay >> >> >> --------------------------------------------------------------------------------------------------------------------------------- >> Then I et the following results >> *Python* >> Status code: 200 >> Headers: Cache-Control >> Expires >> Access-Control-Allow-Origin >> Date >> Content-Type >> Transfer-Encoding >> Keep-Alive >> Connection >> Content: >> >> {"serviceResult":{"message":"0918be3d-7fa0-42dc-81d6-fbbddcfe8320","type":"SUCCESS"}} >> >> *curl* >> >> {"serviceResult":{"message":"4ef55431-b44d-416b-88c6-b40d0299d599","type":"SUCCESS"}} >> >> Firefox >> >> - >> >> >> >> serviceResult >> message "8b983736-6f71-4a1a-bb3b-f42dc87d86db" >> type "SUCCESS" >> >> >> Obviously Login works. >> >> ============================================================================ >> Next step now >> >> This is obviously the REST API interface that I used here according to >> the information provided here >> https://localhost:5443/openmeetings/services/?_wadl >> >> Now how I can test the SOAP API interface >> https://localhost:5443/openmeetings/services/services >> >> The url given with my system is >> https://localhost:5443/openmeetings/services/UserService >> >> Nothing else, so I tried several approaches. For instance >> >> curl -k -H "Content-Type: application/json" -X get ' >> https://localhost:5443/openmeetings/services/UserService/login?user=admintest&pass=%211Qay >> ' >> curl -k -H "Content-Type: application/json" -X get ' >> https://localhost:5443/openmeetings/services/UserService?user=admintest&pass=%211Qay >> ' >> >> I get >> >> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> >> <soap:Body> >> <soap:Fault> >> <faultcode> >> soap:Server >> </faultcode> >> <faultstring> >> HTTP verb was not GET or POST >> </faultstring> >> </soap:Fault> >> </soap:Body> >> </soap:Envelope> >> >> *The Browser* >> >> https://localhost:5443/openmeetings/services/UserService?user=admintest&pass=%211Qay >> yields >> >> <soap:Envelope> >> <soap:Body> >> <soap:Fault> >> <faultcode>soap:Server</faultcode> >> <faultstring> >> No binding operation info while invoking unknown method with >> params unknown. >> </faultstring> >> </soap:Fault> >> </soap:Body> >> </soap:Envelope> >> Best K. >> which is a bit different but not helpful either >> >> Same story with python, so what's wrong with my URL? >> >> >> Best K. >> >> Am Sa., 18. Apr. 2020 um 18:06 Uhr schrieb Daniel Baker < >> [email protected]>: >> >>> And you can view the API services available on your site: >>> >>> https://test.org:5443/openmeetings/services/services >>> <https://ukom.hopto.org:5443/openmeetings/services/services> >>> >>> https://om.alteametasoft.com:8443/next/services/services >>> >>> >>> >>> On 18/04/2020 15:42, Maxim Solodovnik wrote: >>> >>> >>> >>> On Sat, 18 Apr 2020 at 19:04, K. Kamhamea <[email protected]> >>> wrote: >>> >>>> The Administration > Configuration Variable *rest.allow.origin* stores >>>> a list of addresses browser Ajax REST requests can be send. I guess the >>>> addresses are accepted in IP4. Are other formats allows as well? What >>>> separator is used? Can IP ranges be specified as well? If so what is the >>>> accepted syntax? >>>> >>> >>> this config sets "Access-Control-Allow-Origin" you can read docs here >>> >>> https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Origin >>> >>> >>>> >>>> Moreover I have a rather general request. >>>> >>>> Does anyone know some more detailed API documentation than this one: >>>> https://openmeetings.apache.org/RestAPISample.html >>>> >>> >>> Javadoc is here >>> https://openmeetings.apache.org/openmeetings-webservice/apidocs/org/apache/openmeetings/webservice/package-summary.html >>> PHP API is here https://github.com/openmeetings/openmeetings-api-plugin >>> You can use OM plugin for Moodle >>> https://github.com/openmeetings/openmeetings-moodle-plugin as an example >>> >>> >>>> >>>> Can anyone provide some code snippets in other programming languages to >>>> learn from? Is some open source code available that employs the API >>>> interface? >>>> >>>> Best regards K. >>>> >>>> >>>> >>> >>> -- >>> Best regards, >>> Maxim >>> >>> -- Best regards, Maxim
