[ 
https://issues.apache.org/jira/browse/USERGRID-938?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16305705#comment-16305705
 ] 

Ankur Mishra commented on USERGRID-938:
---------------------------------------

Hi,
I have tried above API to clear application data & following are my findings.

*Usergrid Version: 2.2.0 (Latest Master: 15 December 2017, commit tag: 
bd2385d76c3343d96b3b8648d1f68904e2247ed7)*

Case 1: Run above api using org admin access token.
DELETE http://localhost:8080/system/applications/<appid>?access_token=<org 
admin token>&confirmApplicationId=<app id>

Response:
{
    "error": "auth_unverified_oath",
    "timestamp": 1514480953778,
    "duration": 0,
    "error_description": "Unable to authenticate OAuth credentials",
    "exception": "org.apache.usergrid.rest.exceptions.SecurityException"
}

Case 2.1: Run above api using superuser access token.
DELETE 
http://localhost:8080/system/applications/<appid>?access_token=<superuser 
token>&confirmApplicationId=<app id>

Response:
{
    "error": "illegal_argument",
    "timestamp": 1514481330377,
    "duration": 0,
    "error_description": "confirmApplicationName query parameter is required",
    "exception": "java.lang.IllegalArgumentException"
}

Above error description clearly indicates that a required query parameter 
"confirmApplicationName" is missing in API request(Note: not mentioned in any 
doc)

Case 2.2: So I updated my API request to this
DELETE 
http://localhost:8080/system/applications/<appid>?access_token=<superuser 
token>&confirmApplicationName=<app id>

Response:
{
    "error": "illegal_argument",
    "timestamp": 1514481691309,
    "duration": 0,
    "error_description": "confirmApplicationName mismatch: 
f48b5655-ebf0-11e7-ba50-0ac1053f7f68 does not equal testapp2",
    "exception": "java.lang.IllegalArgumentException"
}

Above error description clearly indicates that value of 
"confirmApplicationName" parameter should be app name instead of appid.

Case 2.3: So I updated my API request to this
DELETE 
http://localhost:8080/system/applications/<appid>?access_token=<superuser 
token>&confirmApplicationName=<app name>

Response:
{
    "action": "clear application",
    "status": "ok",
    "data": {
        "jobId": "fa667bc4-ebf3-11e7-ba50-0ac1053f7f68",
        "status": "STARTED"
    },
    "timestamp": 1514481876869,
    "duration": 6
}

JIRA comment 2. just hit the end point until it returns 0 results to clear an 
entire app. End point never returns 0.

*Conclusion:* If we execute case 2.3 then we will be able to clear application 
data. 
1. It will clear custom collections & their documents.
2. It does not clear default collections & their documents. For example users 
collection & it's data is not being cleared.

Thanks


> Create a tool with the capability to wipe an application from Cassandra
> -----------------------------------------------------------------------
>
>                 Key: USERGRID-938
>                 URL: https://issues.apache.org/jira/browse/USERGRID-938
>             Project: Usergrid
>          Issue Type: Story
>            Reporter: Jeffrey 
>            Assignee: Shawn Feldman
>            Priority: Blocker
>             Fix For: 2.2.0
>
>
> Given an App ID, we need to be able to wipe the data from Cassandra.  This 
> can be standalone.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to