GroveStreams
PigFarmer private msg quote post Address this user
I really wish I was better at these REST API structures. So, I have created a component template and I want Grovestreams to auto-create this template when it gets a new component coming in from my mobile app. I just cannot get it to work.

Here is what I am trying to do:

Key:
{{GS_Org_GUID}} = Grovestream API Key
{{Barn_Name}} = normal name for barn, ex. Joes Barn
{{barn_guid}} = guid uniquely given to each barn set up in my app.
{{place_qty}} = the numeric input from the app
{{epoch}} = epoch miliseconds of when the data was input


Destination URL: http://grovestreams.com:80/api/feed?api_key={{GS_Org_GUID}}

Body:
[
{
"compTmplId": "all",
"compName": {{barn_name}},
"compId": {{barn_guid}},
"streamId": "place_qty",
"data": {{place_qty}},
"time": {{epoch}}
}
]

What am i doing wrong??????? Why won't GS pick up my template id? I did confirm that my template name and id are both called all. My barn_name i made sure had no weird characters that won't pass in a url.
Post 1 IP   flag post
PigFarmer private msg quote post Address this user
I started playing with API Tracing and am closing in on my problem, i think
Post 2 IP   flag post
MikeMills private msg quote post Address this user
I believe compName and compTmplId is a URL parameter, not part of the body JSON.
Post 3 IP   flag post
PigFarmer private msg quote post Address this user
SUCCESS! Thanks Mike.

I got the template to link, that was huge right there.

I was not able to get the component name to work though. This is what I had put in for my url. Template worked, name did not.

http://grovestreams.com/api/feed?compTmplId=all&compName=Weather&api_key={{GS_Org_GUID}}
Post 4 IP   flag post
MikeMills private msg quote post Address this user
compName will only set the name of the component when it is initially created from the template. Future Feed PUTs with the compName parameter will not rename the existing component.
Post 5 IP   flag post
PigFarmer private msg quote post Address this user
It was the first entry for that component and it didn't create it with the name. I will play with it some more and see if i can figure it out.
Post 6 IP   flag post
PigFarmer private msg quote post Address this user
I can't figure it out. I put it in the url and the json body and it doesn't take. API tracking doesn's say there is a problem

When its in the url
Call Details:
URL:
http://grovestreams.com/api/feed?compTmplId=all&compName=Weather&api_key=2f0812ad-a068-38be-af68-a01b7e1ebd73&CompanyId=28384&IntegrationKey=79693704972c4aa2b209eea551d7ca35
Method: PUT
Process Time: 2.507 seconds
Client Address: 23.96.6.85
Client Attributes: {org.restlet.http.version=1.1, org.restlet.http.headers=[[content-type: application/json], [accept: application/json], [Accept-Encoding: gzip,deflate], [host: grovestreams.com], [content-length: 145], [connection: Keep-Alive]], org.restlet.startTime=1458684153263}
Request Body:

[ { "compId": 9277d2e5-a130-45e0-8ab6-b3c36c64801d-all, "streamId": "found", "data": 1, "time": 1458684149000 } ]


Response Body:



When its just in the JSON

Call Details:
URL:
http://grovestreams.com/api/feed?compTmplId=all&api_key=2f0812ad-a068-38be-af68-a01b7e1ebd73&CompanyId=28384&IntegrationKey=79693704972c4aa2b209eea551d7ca35
Method: PUT
Process Time: 2.888 seconds
Client Address: 23.96.6.85
Client Attributes: {org.restlet.http.version=1.1, org.restlet.http.headers=[[content-type: application/json], [accept: application/json], [Accept-Encoding: gzip,deflate], [host: grovestreams.com], [content-length: 200], [connection: Keep-Alive]], org.restlet.startTime=1458762288266}
Request Body:

[ { "compId": 7d5364ae-f063-46d1-be28-9b78a1af33da-all, "compName": 7d5364ae-f063-46d1-be28-9b78a1af33da, "streamId": "found", "data": 2, "time": 1458762279000 } ]


Response Body:
Post 7 IP   flag post
2968 7 7
Log in or sign up to compose a reply.