Skip to content
Snippets Groups Projects
tips.md 1.8 KiB
Newer Older
  • Learn to ignore specific revisions
  • # 💡 Tips
    
    Bastien DUMONT's avatar
    Bastien DUMONT committed
    ## 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.
    
    Hugo NOUTS's avatar
    Hugo NOUTS committed
    All possibility are described in the [data section of Cozy documentation](https://docs.cozy.io/en/cozy-stack/data-system/).
    
    Bastien DUMONT's avatar
    Bastien DUMONT committed
    ### Get example
    
    Hugo NOUTS's avatar
    Hugo NOUTS committed
    The example will describe how to query userChallenge data from "ecolyotest" instance.
    
    Hugo NOUTS's avatar
    Hugo NOUTS committed
    First, you need to be able to connect to the instance in order to retrieve the bearer and the cozysessid.
    
    
    ![Bearer&cozysessid](/img/bearer_cozysessid.png)
    
    Then use postman to query the data:
    
    Bastien DUMONT's avatar
    Bastien DUMONT committed
    
    
    ```
    Verb: GET
    Request: https://ecolyotest.cozy.self-data.alpha.grandlyon.com/data/com.grandlyon.ecolyo.userchallenge/_all_docs?include_docs=true
    
        Accept: application/json
        content-type: application/json
    
    Hugo NOUTS's avatar
    Hugo NOUTS committed
        Authorization: Bearer xxxxxxxxxxx
        Cookie: cozysessid=xxxxxxxxxxx
    
    
    The result will then be retrieve by postman:
    
    Bastien DUMONT's avatar
    Bastien DUMONT committed
    
    ```json
    
    {
        "total_rows": 1,
        "offset": 0,
        "rows": [
            {
                "id": "a353b985c0c5f09229b0acd6b2f37f1b",
                "key": "a353b985c0c5f09229b0acd6b2f37f1b",
            ...
        ]
    }
    
    Yoan VALLET's avatar
    Yoan VALLET committed
    ```
    
    ## Delete a doctype from a instance
    
    
    Bastien DUMONT's avatar
    Bastien DUMONT committed
    You can use ACH to delete a doctype.
    
    Yoan VALLET's avatar
    Yoan VALLET committed
    Please find the [ACH documentation](https://npm.io/package/cozy-ach) to see all commands
    
    
    Bastien DUMONT's avatar
    Bastien DUMONT committed
    ### Delete example
    
    Hugo NOUTS's avatar
    Hugo NOUTS committed
    The example will describe how to drop userChallenge doctype from "ecolyotest" instance.
    
    Yoan VALLET's avatar
    Yoan VALLET committed
    the token provided is the one present in the cozysessid.
    
    
    Bastien DUMONT's avatar
    Bastien DUMONT committed
    ```sh
    ach -t xxxxxxxxxxx -u https://ecolyotest.cozy.self-data.alpha.grandlyon.com drop com.grandlyon.ecolyo.userchallenge
    
    Bastien DUMONT's avatar
    Bastien DUMONT committed
    The doctype `com.grandlyon.ecolyo.userchallenge` will be removed.
    
    Type `yes` to continue.
    
    Bastien DUMONT's avatar
    Bastien DUMONT committed
    A browser window will be opened asking for authorization to access to your file.
    
    Hugo NOUTS's avatar
    Hugo NOUTS committed
    Just click on "Authorize" to keep on with the doctype dropping.