Hi Maxim, thank you very much! I try this new improvement and let you know if everything is ok! ;)
Alessio 2016-10-10 5:30 GMT+02:00 Maxim Solodovnik <[email protected]>: > Hello Alessio, > > I believe this [1] commit might be interesting for you :) > I have added "createFile" method and basic test to prove it works :) > > [1] https://github.com/openmeetings/openmeetings-api-plugin/commit/ > 51ccde85b71bc32b1e4c5074171822606606dfad > > On Thu, Sep 22, 2016 at 11:35 PM, Maxim Solodovnik <[email protected]> > wrote: > > Hello Alessio, > > > > I don't have time right now to implement it in PHP, maybe next week :(( > > > > Here is the example of how this method is currently used [1] [2], it's > not > > PHP but you will get an idea > > RestCall is custom class [3] > > I'll try to improve PHP API, please ping me if I'll be too silent > > > > [1] > > https://github.com/apache/openmeetings/blob/3.1.x/ > openmeetings-flash/src/main/swf/modules/conference/ > tabcontent/fileexplorer/fileExplorer.lzx#L212 > > [2] > > https://github.com/apache/openmeetings/blob/3.1.x/ > openmeetings-flash/src/main/swf/modules/conference/ > tabcontent/fileexplorer/fileExplorer.lzx#L225 > > [3] > > https://github.com/apache/openmeetings/blob/3.1.x/ > openmeetings-flash/src/main/swf/base/remote/restCall.lzx#L172 > > > > On Thu, Sep 22, 2016 at 10:21 PM, Alessio Falsetti < > [email protected]> > > wrote: > >> > >> Hi Maxim, > >> > >> I made many test, this is an example of what I tried to do: > >> > >> ---------------------------------- > >> $restService = new OmRestService(); > >> $path = "http://www.mysite.com/myfile.jpg"; > >> $data = array("ownerId" => 2, > >> "externalId" => 1000, > >> "externalType" => "moodle", > >> "roomId" => 12, > >> "parentId" => 0, > >> "name" => "myfile.jpg" > >> ); > >> > >> $streamData = new CurlFile($path, 'image/jpg'); > >> > >> $params = array("file" => json_encode($data), > >> "stream" => $streamData > >> ); > >> // Chiama la funzione per importare i file > >> $result = $restService->call($this->getRestUrl("file"), > >> RestMethod::POST, > >> $this->sessionId, > >> $params, > >> null, > >> "fileExplorerItemDTO"); > >> ---------------------------------- > >> > >> If I use > >> $streamData = '@'.$path > >> > >> or > >> > >> new CurlFile($path, 'image/jpg'); > >> > >> the result does not change. Service return this error: "Request > >> OpenMeetings! OpenMeetings Service failed and no response was returned. > >> Additioanl info:" > >> but Additional info is empty. > >> > >> No duobt there is an error in the SOAP parameters, but digging in the > Java > >> source code of OM, in the class FileExplorerItemDTO there is'nt method > >> fromString, which has been present in the RoomDTO class or > ExternalUserDTO. > >> > >> Where is the mistake? > >> > >> Thank you, and please let me know. > >> > >> > >> Alessio > >> > >> > >> > >> 2016-09-20 20:18 GMT+02:00 Maxim Solodovnik <[email protected]>: > >>> > >>> Current version of the Gateway is unable to work with files > >>> But there are lots of examples (for ex. here > >>> http://blog.derakkilgo.com/2009/06/07/send-a-file-via- > post-with-curl-and-php/) > >>> how this can be implemented > >>> I can add it to the api > >>> https://github.com/openmeetings/openmeetings-api-plugin > >>> but unfortunately not right now :( > >>> > >>> On Tue, Sep 20, 2016 at 11:56 PM, Alessio Falsetti > >>> <[email protected]> wrote: > >>>> > >>>> Hello Hemant, > >>>> > >>>> thank you for your help! I had already seen this documentation, but > >>>> there is still the problem of inserting files into the room. With the > >>>> previous version of OM Gateway & APIs, I call this: > >>>> > >>>> $result = $restService->call($this->getRestUrl("FileService") . > >>>> "importFile?SID=" . $this->session_id > >>>> . "&externalUserId=" . urlencode($userId) > >>>> . "&externalFileId=" . $externalFileId > >>>> . "&externalType=" . urlencode($externalType) > >>>> . "&room_id=" . urlencode($room_id) > >>>> . "&isOwner=" . $isOwner > >>>> . "&path=" . urlencode($path) > >>>> . "&parentFolderId=" . $parentFolderId > >>>> . "&fileSystemName=" . urlencode($fileSystemName)); > >>>> > >>>> and everything works smoothly, OM takes the files directly from the > URL > >>>> specified in "path". > >>>> > >>>> With the new version, this no longer works, and the funcion "add" is > >>>> described in the documentation as follows: > >>>> ------------------------------------------------------------------ > >>>> > >>>> add > >>>> > >>>> @POST > >>>> @Consumes(value="multipart/form-data") > >>>> @Path(value="/") > >>>> public FileExplorerItemDTO add(@QueryParam(value="sid") > >>>> String sid, > >>>> FileExplorerItemDTO file, > >>>> InputStream stream) > >>>> throws > >>>> org.apache.openmeetings.webservice.error.ServiceException > >>>> > >>>> to add a folder to the private drive, set parentFileExplorerItemId = 0 > >>>> and isOwner to 1/true and externalUserId/externalUserType to a valid > user > >>>> Parameters:sid - The SID of the User. This SID must be marked as > logged > >>>> infile - the The file to be addedstream - the The file to be added > Returns:- > >>>> Object created > >>>> ------------------------------------------------------------------ > >>>> > >>>> How do I pass the FileExplorerItemDTO and, above all, the InputStream > >>>> through OmGateway.php or OmRestService,php?? > >>>> > >>>> Thank you and let me know! > >>>> > >>>> Alessio > >>>> > >>>> > >>>> > >>>> > >>>> 2016-09-19 19:13 GMT+02:00 Coscend@OM <[email protected]>: > >>>>> > >>>>> Hello Alessio, > >>>>> > >>>>> Guide and snippets: > >>>>> https://github.com/openmeetings/openmeetings-api-plugin/wiki > >>>>> Moodle plugin: http://openmeetings.apache.org/MoodlePlugin.html > >>>>> > >>>>> Thank you. > >>>>> > >>>>> Sincerely, > >>>>> > >>>>> Hemant K. Sabat > >>>>> > >>>>> Coscend Communications Solutions > >>>>> Web site: www.Coscend.com > >>>>> ------------------------------------------------------------------ > >>>>> CONFIDENTIALITY NOTICE: See 'Confidentiality Notice Regarding E-mail > >>>>> Messages from Coscend Communications Solutions' posted at: > >>>>> http://www.Coscend.com/Terms_and_Conditions.html > >>>>> > >>>>> > >>>>> > >>>>> -----Original Message----- > >>>>> From: Alessio Falsetti [mailto:[email protected]] > >>>>> Sent: Monday, September 19, 2016 12:08 PM > >>>>> To: [email protected] > >>>>> Subject: REST API > >>>>> > >>>>> Hi, > >>>>> > >>>>> through the REST API of OpenMeetings (3.1.1), I'm trying to upload > >>>>> files into a room. > >>>>> > >>>>> I'm trying to use the FileWebService API to add the files. Reading > the > >>>>> documentation I seem to have understood that the function to be used > is ADD, > >>>>> but until now I have not been successful use it, because I have not > clear > >>>>> what and how parameters needs to pass to the function. > >>>>> > >>>>> Where can I find a *working* example in PHP? > >>>>> Thanks a lot! > >>>>> > >>>>> Alessio > >>>>> > >>>>> > >>>>> > >>>>> > >>>>> ----- > >>>>> No virus found in this message. > >>>>> Checked by AVG - www.avg.com > >>>>> Version: 2016.0.7797 / Virus Database: 4656/13044 - Release Date: > >>>>> 09/19/16 > >>>>> > >>>> > >>> > >>> > >>> > >>> -- > >>> WBR > >>> Maxim aka solomax > >> > >> > > > > > > > > -- > > WBR > > Maxim aka solomax > > > > -- > WBR > Maxim aka solomax >
