GroupShare API Projects and File Upload

Hi,

I'm running into an issue using the GroupShare 2017 API.

So basically if I create a project using the GroupShare UI and then use the REST API to upload a file I'm not able to open that project in Studio. I get the "Failed to open server project error".

Maybe I'm just using the API the wrong way but the requirement is to push several files to an existing project and then retrieve the translation later by using the webhook service.

Repro steps are:

- Create project using GS UI

- Upload file using the method displayed here

https://community.sdl.com/developers-more/developers/language-developers/w/wiki/3451/how-to-upload-files-to-an-existing-gs-project

- Go to studio and try to open the project from the server

Repro steps 2:

- Create project using GS UI

- Open project from studio (it works here)

- Upload file using the method displayed here

https://community.sdl.com/developers-more/developers/language-developers/w/wiki/3451/how-to-upload-files-to-an-existing-gs-project

- Go to studio (now it complains that project was unpublished from the server)

Any help is greatly appreciated.

Thanks

Parents
  • Hi Joao, 

    Mid-project updates are not supported by GroupShare. This means that after a project was created (either from Studio or GroupShare) it is not possible to add any more files to the project. 

    Basically what happens in your case, after a project was published you call the api/projectserver/v2/projects/{project id}/files/upload endpoint again. This will add the file to the project and it will trigger additional batch tasks (convert to translateable, do initial assignments, etc). However since there was already a project published with the same ID - the result will be undefined. That's why you get the error in Studio. 

    There's a flag in the Rest API files upload endpoint to signal that you're "just" uploading files but do not want to trigger the project creation process. This will allow you to call the upload endpoint as many times as you wish to add files to a "future" project. 

    The steps to do this is as follows: 

    - do a POST request to /api/projectserver/v2/projects with project information JSON payload to create the project "skeleton". This call will return a project unique identifier. 

    - do one or more POST requests to /api/projectserver/v2/projects/{project id from first step}/files/upload&create={true|false} to upload files for the project. Adjuest the create flag in the query string to signal that you're finished with uploading files and project creation can be scheduled. By default this flag is set to true (i.e. after the first upload request project creation will be triggered). 

    Let us know if you need any more clarification or help!

Reply
  • Hi Joao, 

    Mid-project updates are not supported by GroupShare. This means that after a project was created (either from Studio or GroupShare) it is not possible to add any more files to the project. 

    Basically what happens in your case, after a project was published you call the api/projectserver/v2/projects/{project id}/files/upload endpoint again. This will add the file to the project and it will trigger additional batch tasks (convert to translateable, do initial assignments, etc). However since there was already a project published with the same ID - the result will be undefined. That's why you get the error in Studio. 

    There's a flag in the Rest API files upload endpoint to signal that you're "just" uploading files but do not want to trigger the project creation process. This will allow you to call the upload endpoint as many times as you wish to add files to a "future" project. 

    The steps to do this is as follows: 

    - do a POST request to /api/projectserver/v2/projects with project information JSON payload to create the project "skeleton". This call will return a project unique identifier. 

    - do one or more POST requests to /api/projectserver/v2/projects/{project id from first step}/files/upload&create={true|false} to upload files for the project. Adjuest the create flag in the query string to signal that you're finished with uploading files and project creation can be scheduled. By default this flag is set to true (i.e. after the first upload request project creation will be triggered). 

    Let us know if you need any more clarification or help!

Children