GroveStreams
pat private msg quote post Address this user
Hi,

Because of the rate limits, I would like to upload a set of data every 30 seconds.
What would be the format of the file and of the PUT http request ?
I only see examples of PUT with a few data in the URL, whereas I want to use PUT with a file containing 50 lines of data for instance.

Thank you
Post 1 IP   flag post
MikeMills private msg quote post Address this user
Some Options:
1) Pass up multiple samples with this API.

2) Pass up mulitple samples with the advanced Feed PUT API.

3) Upload a file into your Organization's Import Profile (click the Admin toolbar option).
a) Create an Import Profile
b) Create a file bucket
c) Create an import profile that can parse the data correctly and put it into a component.
d) Schedule the Import Profile to run every so many minutes within a Runnable (Under the Admin options).

Option three will be a bit complicated as we haven't documented the API to upload a file into a file bucket, but you can do it from within the browser manually while watching the browser's debug Network tab to see how it is done.
Post 2 IP   flag post
pat private msg quote post Address this user
OK I understand the format of the file but what would be the format of the URL ?
Post 3 IP   flag post
MikeMills private msg quote post Address this user
Not sure, I don't think anyone has tried it before. You can look at the API call that the browser makes to GS by hitting F12 in Chrome and monitoring the Network tab while uploading a file into the file bucket manually. I just did it:




From this it looks like:
PUT https://www.grovestreams.com/api/organization/91742939-xxxx-3dad-80d0-da5ffb90e4e8/filebucket/Bucket1/upload?org=91742939-xxxx-3dad-80d0-da5ffb90e4e8&api_key=xxxxxxxx

Append your secret api_key to the end of the url. Make sure it has PUT rights for "organization/*/filebucket/*/upload"

The UID is your organization UID. Bucket1 is the name of the bucket (avoid encodable characters such as spaces in the name).

Here are the import Request Headers:
Accept:text/html,application/xhtml+xml,application/xml;
Content-Length:1862
Content-Type:multipart/form-data; boundary=----WebKitFormBoundaryEdXoODzNVAgkUFVW

I'm hoping that's enough information to allow you to Google how to upload a file using the programming language/library that you're using.

In the long run, you would probably save more dev time and I/O using our Feed PUT call with Compressed (gzip) body which we support.
Post 4 IP   flag post
pat private msg quote post Address this user
I used the 2nd option with gzip compression.
Everything works good.

My new question is linked to the API limits as I understand that it is about 1 PUT per 12 seconds by IP Source.
As I need a different API key for every organization, I need 1 PUT per organization.
How would I handle 20 organizations to be in the API limits ?
Should I then need to wait 12x20 seconds to feed the data for each organization ?

Thank you for your advice.
Post 5 IP   flag post
MikeMills private msg quote post Address this user
Use X-Forwarded-For in your header to make the call unique.
Post 6 IP   flag post
2965 6 6
Log in or sign up to compose a reply.