Upload Input File

A REST request is made to the GMUS to upload an input file with the G-Repository Client. The request uploads a file to a specified location on the server. It requires a G-Repository Client name, which can be any G-Repository Client, for license validation purposes. 

  • The file is passed as a raw binary stream in the request body (application/octet-stream).
  • The metadata is passed in the custom request header jsonRequest as a JSON string.


URL - http://<GMUS_IP>:8090/rest/repoUploadFile


Required Headers

Accept: application/json

Content-Type: application/octet-stream

jsonRequest: JSON string containing metadata about the file upload (see table below).

jsonRequest Parameters

Parameter
RequiredDescription
clientAppId
YesApplication identifier.
clientUserIdYesUser Identifier within the application.
username
YesUser's email address.
repoNameYes
G-Repository Client name. Can be any G-Repository Client (used for license validation)
filePathYesLocation on the Server where the file needs to be uploaded.
fileSubDirOptionalAn optional subdirectory where the file will be stored. 
fileNameYesThe name that will be given to the uploaded file.
profileId
NoRequired only when the file path is a resource variable. An example is provided below. 


jsonRequest Example

{
   "clientAppId": "XXXXXXXX-1e47-abcd-ba66-XXXXXXXXXXXX",
   "clientUserId": "XXXXXXXX-abcd-4284-aa45-XXXXXXXXXXXX",
   "username": "jane.doe@gmail.com",
   "repoName": "sampleRepo",
   "filePath": "/home/jDoe/Downloads/output",
   "fileSubDir": "output1",
   "fileName": "Test.json"
 }

Note: For Windows machines, the filePath should have two slashes: C:\\Users\\jDoe\\Downloads\\output.

If you choose to provide the Resource Variable as a file path, you must also include the profileId parameter. You can obtain the Profile ID from the "My Organization" page within the GenRocket Web Platform.

{
     "clientAppId": "XXXXXXXX-1e47-abcd-ba66-XXXXXXXXXXXX",
     "clientUserId": "XXXXXXXX-abcd-4284-aa45-XXXXXXXXXXXX"",
     "username": ""jane.doe@gmail.com",
     "repoName": "sampleRepo",
     "filePath": "#{resource.output.directory}",
     "profileId":"<PROFILE_ID>",
     "fileSubDir": "output1",
     "fileName": "Test.json",
 }

Request Body - contains the file that needs to be uploaded

curl --location 'http://<GMUS_IP>:8090/rest/repoUploadFile' \
  --header 'Accept: application/json' \
  --header 'Content-Type: application/octet-stream' \
  --header 'jsonRequest: { 
     "clientAppId": "XXXXXXXX-1e47-abcd-ba66-XXXXXXXXXXXX",
     "clientUserId": "XXXXXXXX-abcd-4284-aa45-XXXXXXXXXXXX",
     "username": "jane.doe@gmail.com",
     "repoName": "sampleRepo",
     "filePath": "/home/jDoe/Downloads/output",
     "fileSubDir": "output1",
     "fileName": "Test.json"
   }' \
  --data-binary '@/home/jDoe/Downloads/jsontest.json'