Third Light Developer Exchange

Code and templating community forum for developers and software integrators

You are not logged in.

Announcement

If you wish to join the Developer Exchange, please contact your account manager - this is to avoid unnecessary spam in the forums. Many thanks for your understanding.

#1 2015-11-30 21:21:03

cwilson
Member
Registered: 2014-12-04
Posts: 3

Asynchronous Uploads

Hello,

I have a few questions regarding asynchronous uploads using the JSON API. I have used the PHP example code (thirdlight.com/docs/display/integration/Upload) as a template for making an asynchronous upload call (I am using C#).

To be clear the basic pattern (after logging in and determining where to upload) is:

Create Upload
Add Files
Start Upload
Check Upload Progress
Complete Upload


The issue I am having is that all uploads seem to be synchronous regardless of the parameters set in the CreateUpload call. An example POST call I am making here is:

{"apiVersion": "1.0.1",
"action": "Upload.CreateUpload",
"sessionId": "GZR0hbzdw4qhIuhWQhpzVZ7JGaaaQV5W",
"inParams": { "params": {"destination": "32783692100",
                        "synchronous": "false",
                        "lifetime": "3600",
                        "editablemetadata": { "caption": "OPTIONAL" },
   
                        }
            }
}

As soon ad I make the AddFilesToUpload call the files are immediatly processed before I make the StartUpload call, returning this response:
{"result":{"api":"OK","action":"OK","timings":{"initTime":200,"setupTime":17,"methodTime":14321,"totalTime":14538}},"outParams":{"succeeded":{"File0":"33007009808","File
":"33007009326","File2":"33007010733","File3":"33007010459","File4":"33007011298","File5":"33007011947"}}}

My application follows the AddFilesToUpload with the StartUpload call which returns this response:
{"result":{"api":"OK","action":"UPLOAD_NOT_FOUND"}}

When I make GetUploadProgress calls this is the response:
{"result":{"api":"OK","action":"UPLOAD_IS_SYNCHRONOUS"}}

Is there something I am missing that keeping the CreateUpload call as synchronous?

On an unrelated note, is it possible to make several AddFilesToUpload calls on the same uploadId? What I am thinking would resemble the following pattern:

Create Upload
Add Files
Start Upload
Add Files...ect
Check Upload Progress
Complete Upload

I am trying to migrate large volumes of images into ThirdLight, and am looking to find the optimal size of each upload call. If you have any suggestions or tips to help me, that would be awesome!

Thanks,

Cody

Offline

#2 2015-12-01 10:54:23

ben
Third Light Staff
From: Third Light
Registered: 2013-06-06
Posts: 66

Re: Asynchronous Uploads

Hi Cody,

I think the main problem here is that you have specified "synchronous" as a string. i.e. the word false is in quotes. In the JSON you send to the server, boolean values should be unquoted. e.g.: {"keyForABoolean":false}

And yes you can make several calls to AddFilesToUpload()

Best wishes,
Ben

Offline

#3 2015-12-15 21:14:30

cwilson
Member
Registered: 2014-12-04
Posts: 3

Re: Asynchronous Uploads

Thanks for your reply Ben, I am now able to correctly create the async upload by passing a bool instead of a string.

I have a few additional follow up questions...

Based on the pattern described above, I am making multiple AddFilesToUpload calls, for now I am making 10 calls with 100 photos in each. What is interesting is that when I monitor the upload, the number of files in the upload (as returned by the GetUploadProgress, and GetUploadResult) is only 200. All 1000 photos are eventually uploaded into destination folder, but these photos are not accounted for by the upload. If I change the number of photos to 25 per AddFilesToUpload call only 100 files are found to be part of the upload. here is an example return from a GetUploadProgress call:

{"result":{"api":"OK","action":"OK","timings":{"initTime":104,"setupTime":17,"methodTime":56,"totalTime":177}},"outParams":{"files":"100","processed":371,"rejected":0,"error":false,"percent":344}}

You can see that the files are 100, but it has processed 371 already..


Is there something i am missing in terms of a maximum number of photos per upload? In terms of performance, do you recommend fewer larger uploads or many smaller uploads called simultaniously?

Thanks in advance,

Cody

Offline

#4 2015-12-16 12:04:18

ben
Third Light Staff
From: Third Light
Registered: 2013-06-06
Posts: 66

Re: Asynchronous Uploads

Thanks Cody,
My immediate thoughts are  that there is a bug there. I will investigate and get back to you.
Ben

Offline

Board footer