How to create a customer and view the customer from javascript API? (particle product)


#1

Hello,

I have been experimenting with particle products, and I have reached a roadblock. I am trying to create customers from my web app (node.js), but I can find no documentation on how to do so. After about 2 hours of trial and error, I managed to create a customer via cURL:

curl -X POST -u pickle-xxxx:xxxxxxxxxxxxxxd9wd9asydu8 -d email=bob@gmail.com -d no_password=true https://api.particle.io/v1/products/{product_slug}/customers

This works fine, it returns the access token and everything. However, when I go to my particle console, click on the product, and click on customers, there are no customers there. Furthermore, I do not know how to view the customers via the API.

Can someone help me figure out how to register a customer with the javascript API, and make sure the customer actually exists?


#2

Customers won’t appear in the console or the API until they claim a device. They exist in a state of limbo where they sort of exist (if you try to create the same customer email it will fail) but won’t show up anywhere. Just proceed to the next step and claim a device; if you succeed the customer was created successfully.

This document may be helpful in figuring out how all of the various pieces fit together. It walks through the process of manually claiming a Photon, both for a developer device and a product device.


#3

Sounds good. Would you know how to register/create a customer through the JavaScript library?


#4

Can any one answer this? Using the official Java Script SDK, what’s the suggested way to do this? It’s a necessary part of the process. Why is it missing from the SDK and documentation???


#5

Those were my thoughts exactly, which I asked in my own thread which also died without being resolved: https://community.particle.io/t/customer-creation-using-js-api/

I think it’s apparent that the Javascript API is not really useful if you plan on having customers use your product. :confounded:

I ended up just using the REST API.

Mike


#6

I’ve had a bit of a play with the js api and got this to run if you still need it. Will see about doing a push request.

Cheers.
Monkey