Integration method for particle.io?

Here is the configuration that allowed me to call two functions in a Particle Photon.
First function does not have parameters and the second has.

rest_command:
  gongreset:
    url: https://api.particle.io/v1/devices/3XXXXXXXXXXX031/gongreset
    method: POST
    headers:
      authorization: Bearer e1792367e5XXXXXXXXXXXXXXXXXXXa82f
      accept: 'application/json, text/html'
      user-agent: 'Mozilla/5.0 {{ useragent }}'
    payload: ''
    content_type:  'application/x-www-form-urlencoded'
    verify_ssl: true
  gongto:
    url: https://api.particle.io/v1/devices/310032XXXXXXXXXX31/gongto
    method: POST
    headers:
      authorization: Bearer e179XXXXXXXXXXXXXXXXXXa82fasd
      accept: 'application/json, text/html'
      user-agent: 'Mozilla/5.0 {{ useragent }}'
    payload: 'arg={{val}}'
    content_type:  'application/x-www-form-urlencoded'
    verify_ssl: true

And then I was able to go to Developer Tools > Services and Call

  • First function does not have parameters:
rest_command.gongreset
  • Second function call and passing parameters:
rest_command.gongto

And the parameters:

Service Data: {  "val":13}

Same command via curl (to test things)

curl https://api.particle.io/v1/devices/310XXXXXXXXXXX031/gongto \
       -d arg="125" \
       -d access_token=e179XXXXXXXXXXXXXXXXXXa82fasd
1 Like