FatFractal customer forums



Author Topic: Deleting FFUsers  (Read 2326 times)

wechambers

  • Newbie
  • *
  • Posts: 2
    • View Profile
Deleting FFUsers
« on: January 10, 2014, 10:47:48 AM »
Greetings,

Is there a way to delete FFUsers and FFNotificationID's? I am essentially trying to start from scratch for testing push notifications, and would like to avoid creating a new application just to purge all of my test users once it is ready for production.

Thanks!
Weston

gkc

  • Administrator
  • *****
  • Posts: 375
    • View Profile
Re: Deleting FFUsers
« Reply #1 on: January 10, 2014, 11:30:19 AM »
Hi there,

New release (being formally released this weekend - i.e. documentation updated etc) includes a new feature, "Delete-by-Query". This release also includes being able to use basic auth so you can do things more easily from the command line. Both of those features are already live in our sandbox environments.

To make this particular example work, you will need to have deployed an app with :
Code: [Select]
SET AllowSystemUserToLogin true
SET SystemUserPassword SecretP4ssw0rd

Now from your command line, type
Code: [Select]
curl --user curl --user system:SecretP4ssw0rd -XDELETE "https://yourdomain.fatfractal.com/yourapp/ff/resources/FFUser/(guid%20ne%20'system'%20and%20guid%20ne%20'anonymous')"
Yes all the %20's are required - need to url-encode the spaces when using curl like this. If you were using from code then it would look like this: (guid ne 'system' and guid ne 'anonymous')

You should see output like this:
{"result":null,"statusMessage":"DELETE /ff/resources/FFUser/(guid%20ne%20'system'%20and%20guid%20ne%20'anonymous') OK - deleted 16 objects"}


Cheers

- Gary

PS Remember that when you are using Basic Auth over the internet or any other insecure network, you must ALWAYS ALWAYS ALWAYS use https !
« Last Edit: January 10, 2014, 01:52:54 PM by gkc »

wechambers

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: Deleting FFUsers
« Reply #2 on: January 10, 2014, 11:45:29 AM »
Thank you Gary,

I am looking forward to the new release with great anticipation.

gkc

  • Administrator
  • *****
  • Posts: 375
    • View Profile
Re: Deleting FFUsers
« Reply #3 on: January 10, 2014, 07:34:28 PM »
Thanks! Me too :-)

Eric

  • Jr. Member
  • **
  • Posts: 61
    • View Profile
Re: Deleting FFUsers
« Reply #4 on: February 23, 2014, 10:02:40 AM »
Delete-by-query sounds great for cleaning up expired stuff in the data store.  Is there a way to do this through the server-side SDK?  Or, what is the best way to use it from scheduled code?

kevin@fatfractal.com

  • Administrator
  • *****
  • Posts: 56
    • View Profile
Re: Deleting FFUsers
« Reply #5 on: February 23, 2014, 11:59:40 AM »
I do this quite often for sample apps using server extensions. Here is a reasonable sample...

Note: have not updated with Delete-by-query feature yet...

https://github.com/FatFractal/fyi.objectsandcollections/blob/master/ff-scripts/extensions.js/#L3-31
« Last Edit: February 23, 2014, 12:01:57 PM by kevin@fatfractal.com »

Eric

  • Jr. Member
  • **
  • Posts: 61
    • View Profile
Re: Deleting FFUsers
« Reply #6 on: February 23, 2014, 12:15:33 PM »
Thank you for the example.  I guess I will stick with my current method until you update with delete-by-query:

Code: [Select]
function deleteByQuery(query) {
var results = ff.getArrayFromUri(query)
for (var i = results.length; --i >= 0;) {
ff.deleteObj(results[i])
}
}

I just thought I would save the multiple API calls, in addition to a few lines of code, using your delete-by-query instead of mine.   :)

 

Copyright © FatFractal customer forums