Skip to content
Snippets Groups Projects
tips.md 1.88 KiB
Newer Older
  • Learn to ignore specific revisions
  • # Tips
    
    ## Query data from an instance
    
    For maintenance reason, we sometime need to check data on a specific instance. For that we use postman to send get / post / delete data.
    All posibility are described in the [data section of Cozy documentation](https://docs.cozy.io/en/cozy-stack/data-system/).
    
    **Example**
    
    
    Yoan VALLET's avatar
    Yoan VALLET committed
    The example will describ how to query userChallenge data from "ecolyotest" instance.
    
    First, you need to be able to connect to the instance in order to retrive the bearer and the cozysessid.
    
    ![Bearer&cozysessid](/img/bearer_cozysessid.png)
    
    Then use postman to query the data:
    ```
    Verb: GET
    Request: https://ecolyotest.cozy.self-data.alpha.grandlyon.com/data/com.grandlyon.ecolyo.userchallenge/_all_docs?include_docs=true
    Header: 
        Accept: application/json
        content-type: application/json
        Authorization: Bearer xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
        Cookie: cozysessid=AAAAAxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    ```
    
    The result will then be retrieve by postman:
    ```
    {
        "total_rows": 1,
        "offset": 0,
        "rows": [
            {
                "id": "a353b985c0c5f09229b0acd6b2f37f1b",
                "key": "a353b985c0c5f09229b0acd6b2f37f1b",
            ...
        ]
    }
    
    Yoan VALLET's avatar
    Yoan VALLET committed
    ```
    
    
    ## Delete a doctype from a instance
    
    You can use ACH to delete a doctype. 
    Please find the [ACH documentation](https://npm.io/package/cozy-ach) to see all commands
    
    **Example**
    
    The example will describ how to drop userChallenge doctype from "ecolyotest" instance.
    the token provided is the one present in the cozysessid.
    
    ```
    $ ach -t xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -u https://ecolyotest.cozy.self-data.alpha.grandlyon.com drop com.grandlyon.ecolyo.userchallenge
    This doctypes will be removed.
    
    * com.grandlyon.ecolyo.userchallenge
    
    Type "yes" if ok.
    yes
    ```
    
    A browser window will be opened asking for authorization to access to your file. 
    Just click on "Authorize" to keep on with the doctype droping.