hutRelay API

post
Register a device

https://relay.hut34.io/registerDevice
API allows the user to register a device from the front-end.
Request
Response
Body Parameters
uid
optional
string
google account uid given when logging in the relay
serviceAccount
optional
string
serviceAccount created by the device. needs to be an object
invocation
optional
string
invocation of the device without the @
metatags
optional
string
metatags of the device separated by commas
idToken
optional
string
idToken given when logging in to check in the backend if it is the user or not
botname
optional
string
Name of the device
200: OK
Returns the dialogFlowAPI that I have created for that bot. Need to be used when talking to another bot (and necessary when generating and filling order in the backend)
alert("You have successfully registered your device. The Fallback Intent of your bot is: https://relay.hut34.io/api/v1/talktothehut/" + result);
400: Bad Request
returns "invocation already exists" if the invocation already exists. Does not return anything if a problem occurs.
else if (result === "Invocation already exists") {
alert("Invocation already exists. Please try again.");
}

post
Update a device

https://relay.hut34.io/updateDevice
Usually on the front end, most of the variables are already available by fetching it from firestore. only botname and metatags can be changed for now. Post the data in the backend and backend only returns state (success or nothing).
Request
Response
Body Parameters
botname
optional
string
changeable
serviceAccount
optional
string
invocation
optional
string
metatags
optional
string
changeable
idToken
optional
string
uid
optional
string
user ID when logging in with google
refID
optional
string
referenceID of the device on firestore
200: OK
Returns success
if(status === "success") {
alert("Your device has been updated successfully.");
}
400: Bad Request
else {
alert("A problem has occured. Please try again.");
}

post
send ENTRP to the device

https://relay.hut34.io/devices/sendENTRP
Funds the account in the backend by sending the info needed. Can only be funded ENTRP once. All data are fetched from firestore when displaying their bots/devices. Only for devices on Relay.
Request
Response
Body Parameters
ethAddress
optional
string
The ethAddress of the device found from firestore using the invocation.
uid
optional
string
user ID from google sign in
refID
optional
string
referenceID of the device from firestore
invocation
optional
string
device's invocation
200: OK
returns "true" (string) when the device has already been funded. Returns the transaction hash if it is successful.
if(result === "true") {
alert("Your device has already been funded once.");
}
else {
alert("tx hash:" + result);
}

post
Send some dust ETH to a device

https://relay.hut34.io/devices/sendETH
Can only be done once. Same concept as the API above but with ETH for the device to fillOrder and approve ENTRP. Only for devices on relay.
Request
Response
Body Parameters
uid
optional
string
userID from google sign in
ethAddress
optional
string
ethAddress from firestore of the device
invocation
optional
string
refID
optional
string
referenceID from firestore
200: OK
if(result === "true") {
alert("Your device has already been funded once.");
}
else {
alert("Follow your transaction at "+ result);
}