google-cloud-platformserver-errorxively

Server error upon adding new device leads to duplicate devices


TL;DR -

I have erroneously created a load of duplicate devices in Xively. How do I delete them, using only my browser? Or do I need to write a Perl script?


I have just opened a new Xively personal account, and was running through the Test Drive.

Upon step 2

Step 2 of Test Drive

I added a new device

Adding new device

Upon clicking Add Device, I received a server error

Server Error upon adding new device

After repeated attempts (clicking on the browser's back button and trying again), I clicked on the Develop link at the top of the page, only to be shown multiple duplicate devices:

Multiple duplicate devices

If I click on a device, to open its Workbench, I get another server error (note that the URL is different from the first):

Server error when clicking on an added device

Is there currently a server error - nothing is mentioned about the server being down in the Twitter feed? How do I delete the duplicate devices, or edit them? Is there a way of managing them? I don't appear to be able to find a link to contact the support desk. Is there actually a support desk available?

Is my account now "ruined"? Should I give it up as a bad job and open a new account?

P.S. When I was adding the devices I was running through a VPN (TunnelBlick on OS X), but surely this should not have caused the issue..?


I have tried following the information from Delete a Device:

Method DELETE

Base URL https://api.xively.com

API Endpoint /v2/products/PRODUCT_ID/devices/SERIAL_NUMBER

However I do not know what the PRODUCT_ID is, and I am only guessing that the SERIAL_NUMBER is the code at the end of the device URL?

  1. Click on one of the duplicate devices to obtain the device URL (even though it still leads to the server error page): https://personal.xively.com/develop/sfStgqRmlqymGIFeHleB
  2. Forming the delete URL: https://api.xively.com/v2/products/PRODUCT_ID/devices/sfStgqRmlqymGIFeHleB
  3. After logging in to confirm the delete action, I get the message

{"title":"Not found","errors":"Couldn't find Product with product_id = PRODUCT_ID"}

How do I discover the PRODUCT_ID?


So, from List All Products:

Method GET

Base URL https://api.xively.com

API Endpoint /v2/products

I used the URL: https://api.xively.com/v2/products

and I get a list of all of my Products, which are actually of the duplicate devices, and a series of different PRODUCT_IDs. (It seems a bit odd that the devices have PRODUCT_IDs and not device SERIAL_NUMBERs):

{"totalResults":7,"products":[{"description":"A sPhone by Smapple","name":"SplunkinsPhone","product_id":"sfStgqRmlqymGIFeHleB","secret":"41aad0ab3fec62efd94fc7d54f77a911f232522d","state":"develop","devices_count":0,"activated_devices_count":0,"feed_defaults":{"title":"SplunkinsPhone","private":"true"},"user":"splunkins"},{"description":"A sPhone by Smapple","name":"SplunkinsPhone","product_id":"luXVnI1ymGHW4SonH-37","secret":"e923aad16dce33e6635e7a8620243110ba93e9cc","state":"develop","devices_count":0,"activated_devices_count":0,"feed_defaults":{"title":"SplunkinsPhone","private":"true"},"user":"splunkins"},{"description":"A sPhone by Smapple","name":"SplunkinsPhone","product_id":"4NV5BvCmx54q84AcVCLB","secret":"13e624cececcecf9af6e558874cdf78e65049fe8","state":"develop","devices_count":0,"activated_devices_count":0,"feed_defaults":{"title":"SplunkinsPhone","private":"true"},"user":"splunkins"},{"description":"A sPhone by Smapple","name":"SplunkinsPhone","product_id":"l8S8kBZWWG_s1YRrytwW","secret":"5a476bc550055d8ab7dc7c72ceb0433fd39e451f","state":"develop","devices_count":0,"activated_devices_count":0,"feed_defaults":{"title":"SplunkinsPhone","private":"true"},"user":"splunkins"},{"description":"A sPhone by Smapple","name":"SplunkinsPhone","product_id":"jWWRuW_JhkXqKUA0F769","secret":"b3a5d78b51dca5d3ef56268141e7c25c8d00a61a","state":"develop","devices_count":0,"activated_devices_count":0,"feed_defaults":{"title":"SplunkinsPhone","private":"true"},"user":"splunkins"},{"description":"A sPhone by Smapple","name":"SplunkinsPhone","product_id":"3nXDH0DV6z3_y5cr47qA","secret":"7793d8607194fec4a7e85c0091df93642fc68069","state":"develop","devices_count":0,"activated_devices_count":0,"feed_defaults":{"title":"SplunkinsPhone","private":"true"},"user":"splunkins"},{"description":"A sPhone by Smapple","name":"SplunkinsPhone","product_id":"TWF2T_IXpS7sDZxSlc2f","secret":"9f03403167b467ec7fec295c87c6260b3a4074cc","state":"develop","devices_count":0,"activated_devices_count":0,"feed_defaults":{"title":"SplunkinsPhone","private":"true"},"user":"splunkins"}]}

Following on from that, from Delete a Product:

Method DELETE

Base URL https://api.xively.com

API Endpoint /v2/products/PRODUCT_ID

I create the URL https://api.xively.com/v2/products/TWF2T_IXpS7sDZxSlc2f

Where TWF2T_IXpS7sDZxSlc2f is the last PRODUCT_ID in the product list generated above. However, this just returns the data for that PRODUCT_ID:

{"product":{"description":"A sPhone by Smapple","name":"SplunkinsPhone","product_id":"TWF2T_IXpS7sDZxSlc2f","secret":"9f03403167b467ec7fec295c87c6260b3a4074cc","state":"develop","devices_count":0,"activated_devices_count":0,"feed_defaults":{"title":"SplunkinsPhone","private":"true"},"user":"splunkins"}}

The issue is now that how do I perform a DELETE method, through my browser, as the URL is just a GET and is basically performing a Read a Product instead of a Delete?


Solution

  • The answer is to, recursively for each PRODUCT_ID, use curl

    curl -X DELETE 'api.xively.com/v2/products/3nXDH0DV6z3_y5cr47qA' -u 'username:password'