PUT with body string and multiple feeds392
Pages:
1pat private msg quote post Address this user | ||
I am using a PUT request with gzip My bodystring is the following
It works good. Now how would I format my bodystring to add the streamId:"humidity" and "data":60 for the same compId and same time and same template ? Do I have to repeat all of it ? I have tried with arrays, comma separated but it doesn't work Is my only way doing this is using the following code :
Isn't there anything shorter ? |
||
Post 1 IP flag post |
MikeMills private msg quote post Address this user | ||
Use the Advanced JSON API. You can add multiple components, each with multiple streams, each with multiple sample times. The time array can be at any level of the JSON structure. For example, if it is at the feed level, then all stream sample values will be saved with that one set of times. This example below has times for each set of samples:
|
||
Post 2 IP flag post |
MikeMills private msg quote post Address this user | ||
Here's an example of one set of time:
|
||
Post 3 IP flag post |
pat private msg quote post Address this user | ||
It seems that your code is even longer then the second one in my post considering that I have one time. For you what would be the shortest code you could get with my example 2 ? (same time, one data per feed) ? |
||
Post 4 IP flag post |
MikeMills private msg quote post Address this user | ||
Unformatted, yours is 191 characters, the advanced API is 178 characters. Here's what it would look like (formatted):
You could shorten it up by giving your stream small IDs such as "T" and "H". Give your template a smaller ID too. Now, the All on the URL call is probably even shorter, but you can't compress that. FYI, you can't pass the compTmplId as part of the JSON API call you had in your first post. It is part of the URL for that call. Note that if you don't pass a sample time, the GS servers will set it for you at the time of the Feed PUT call. That would save some chars too. |
||
Post 5 IP flag post |
pat private msg quote post Address this user | ||
1) It seems that with the standard API I can upload different compId in the same body but it is not possible to use different comTmplId (as it is in the http request), is that correct ? 2)With the advanced API, I didn't see how I can upload data for multiple compId and multiple streams is that possible ? |
||
Post 6 IP flag post |
MikeMills private msg quote post Address this user | ||
1. Yes 2. Yes. The JSON structure supports an Array of component and an Array of Streams for each component:
|
||
Post 7 IP flag post |
pat private msg quote post Address this user | ||
Sorry I meant for point 2. for multiple compId and multiple streams is that possible with a time different for each ComponentId | ||
Post 8 IP flag post |
MikeMills private msg quote post Address this user | ||
Yes, just move the time JSON attribute to under each component:
|
||
Post 9 IP flag post |
pat private msg quote post Address this user | ||
Hi, I am pushing data for different customers and each customer has its own API key. Is it possible with a single PUT to push data with different API_KEY ? Or when doing a PUT, all data must use the same API_KEY ? |
||
Post 10 IP flag post |
MikeMills private msg quote post Address this user | ||
Quote:Originally Posted by pat- No Quote: Originally Posted by pat- Yes |
||
Post 11 IP flag post |
Pages:
1