Let me explain a bit more with some examples:
Â
FMEServer.getSession(BuildForm.repository, BuildForm.workspaceName, function(json){
        BuildForm.session = json.serviceResponse.session;
        sessionCode = BuildForm.session;
        BuildForm.path = json.serviceResponse.files.foldera0].path;
results in this response:
{"serviceResponse":Â {
   "statusInfo": {"status": "success"},
   "session": "35049821",
   "files": {
      "path": "",
      "folder": Â{
         "path": "$(FME_DATA_REPOSITORY)/myworkspace/myworkbench.fmw/35049821",
         "name": ""
      }]
   }
}}
but then, my upload request
$('#fileupload').fileupload({
            url : BuildForm.host + '/fmedataupload/' + BuildForm.repository + '/' +  BuildForm.workspaceName + '&opt_namespace=' + sessionCode, Â
             headers : {
                'Authorization' : 'fmetoken token=' + BuildForm.token
                 },
            dropzone : $('#dropzone'),
            autoUpload : true,
gives the following response:
{"serviceResponse":Â {
   "statusInfo": {"status": "success"},
   "session": "admin",
   "files": {
      "path": "",
      "file": /{
         "size": 162240,
         "name": "myfile.zip"
      }],
      "folder": n{"name": ""}]
   }
}}
 where the session parameter is suddenly "admin" (same as the username of the fme token).
I want this parameter to be the session ID (in this example, 35049821).
Â
Thanks!
The symptom seems to be a known bug once occurred in FME Server 2018.0.0.0. Upgrade the FME Server version if you are using 2018.0.0.0, and use the FMEServer.js library version v3.
Hi @flipvandervalk,
this issue could occur if you are using FME Server 2018.0 with FME Server JS API version 1.1 older lower. If you switch to this FME Server JS API version your script should work and the correct files should be found:
Â
Â
https://api.fmeserver.com/js/v3/FMEServer.js