---
# System prepended metadata

title: Api List for CUS
tags: [Other, Cart, Order, Shipping address, Authentication, Wishlist]

---


# Api List for CUS 

## Note: For Request you have use add in request body or use as parameter it's work both.

## Request Header: have have to add Authorization in format
    ```
        Authorization: Bearer (Token Value),
    ```

###### tags: `Authentication`

###### You can check token value in odoo system param
- Login API
    - URL: `odoo_web/mobile/login`
    - header: Authorization with client_id:1
    - POST
        - request
        ```json=
        {
            "username": "admin",
            "password": "admin"
        }
        ```
        - Response
            1. if Success: Status 200 with user_id
            2. If False: Status 403 (message Wrong username/password)

- Change password 

    - URL: `odoo_web/mobile/change_password`
    - header: Authorization with client_id:1
    - POST
        - request
        ```json=
        {
            "username": "admin",
            "old_password": "admin",
            "new_password": "new_password"
        }
        ```
        - Response
            1. if Success: Status 200 with message success
            2. If False: Status 403 (message Login Error)

- Reset password 

    - URL: `odoo_web/mobile/reset_password`
    - header: Authorization with client_id:1
    - POST
        - request
        ```json=
        {
            "username": "admin",
        }
        ```
        - Response
            1. if Success: Status 200 with message success
            2. If False: Status 403 (message Reset Password Error)

- Update profile 

    - URL: `odoo_web/mobile/update_profile`
    - header: Authorization with client_id:1
    - POST
        - request
        ```json=
        {
            "username": "username",
            "values": {
                "email": "example@example.com",
                ...
                (Other field example: name ...)
            }
        }
        ```
        - Response
            1. if Success: Status 200 with message success
            2. If False: Status 403 (message Update Profile error)

###### tags: `Cart`

- For Checkout Process I'm not sure how to implementit yet.

- Cart items list 

    - URL: `odoo_web/mobile/cart_list`
    - GET
        - Request
            1. user_id: (user_id)
        - Response
        ```json=
        {
            "order_id": 47,
            "name": "S00046",
            "date_order": "2020-12-08T08:25:29",
            "amount_untaxed": 48.0,
            "amount_tax": 0.0,
            "amount_total": 48.0,
            "line": [
                {
                    "id": 133,
                    "product_id": 12,
                    "name": "test",
                    "qty": 4.0,
                    "product_uom": "Units",
                    "price_unit": 12.0,
                    "price_subtotal": 48.0
                }
            ]
        }
        ```
- Add to cart 

    - URL: `odoo_web/mobile/add_to_cart`
    - POST
        - request
        ```json=
        {
            "lines": [
               {
                  "name":"[FURN_5555] Cable Management Box",
                  "product_id":12,
                  "product_uom_qty":4,
                  "price_unit":12
               },
               {
                  "name":"[FURN_5555] Cable Management Box 2",
                  "product_id":13,
                  "product_uom_qty":2,
                  "price_unit":1
               },
            ],
            "user_id": (user_id)
        }
        ```
        - Response
            1. if Success: Status 200 with message success
            2. If False: Status 403 (message Add to Cart Error)

- Remove from cart

    - URL: `odoo_web/mobile/remove_from_cart`
    - POST
        - request
        ```json=
        {
            "lines": [1,2,3] (cart line id)
        }
        ```
        - Response
            1. if Success: Status 200 with message success
            2. If False: Status 403 (message Remove From Cart Error)

- Edit cart item

    - URL: `odoo_web/mobile/edit_cart`
    - POST
        - request
        ```json=
        {
           "lines":[
              [
                 "id",{"key":"val"}
              ],
              [
                 1,{
                    "name":"123",
                    (... field name to update)
                 }
              ]
           ]
        }
        ```
        - Response
            1. if Success: Status 200 with message success
            2. If False: Status 403 (message Edit Cart Error)

###### tags: `Wishlist`

- Add to Wishlist 

    - URL: `odoo_web/mobile/add_to_wish`
    - POST
        - request
        ```json=
        {
           "product_id":123,
           "user_id": (user_id)
        }
        ```
        - Response
            1. if Success: Status 200 with wish_id
            2. If False: Status 403 (message Add to Wishlist Error)

- Remove from Wishlist 

    - URL: `odoo_web/mobile/remove_from_wish`
    - POST
        - request
        ```json=
        {
           "wish_id":123
        }
        ```
        - Response
            1. if Success: Status 200 with message success
            2. If False: Status 403 (message Add to Wishlist Error)

- Wishlist items list 

    - URL: `odoo_web/mobile/get_wish`
    - GET
        - request
            1. "user_id": (user_id)
        - Response
            ```json=
            {
                "wishes": [
                    {
                        "id": 11,
                        "product_id": 12,
                        "product_name": "Customizable Desk (CONFIG)",
                        "price": 750.0
                    }
                ]
            }
            ```

###### tags: `Order`

- Order list

    - URL: `odoo_web/mobile/order_list`
    - GET
        - request
            1. user_id: (user_id)
        - Response
            ```json=
            
            { 
                "orders": [
                    {
                        "id": 47,
                        "name": "S00046",
                        "date": "2020-12-08T08:25:29",
                        "state": "draft",
                        "amount_untaxed": 48.0,
                        "amount_tax": 0.0,
                        "amount_total": 48.0
                    },
                    {
                        "id": 46,
                        "name": "S00045",
                        "date": "2020-11-19T04:10:18",
                        "state": "sale",
                        "amount_untaxed": 20.0,
                        "amount_tax": 3.0,
                        "amount_total": 23.0
                    },
                ]
            }
            
            ```

- Order detail

    - URL: `odoo_web/mobile/order_detail`
    - GET/POST
        - request
            ```json=
            {
               "order_id":47
            }
            ```
        - Response
            ```json=
            {
                "id": 47,
                "name": "S00046",
                "date": "2020-12-08T08:25:29",
                "state": "draft",
                "order_line": [
                    {
                        "id": 133,
                        "product_id": 12,
                        "name": "test",
                        "qty": 4.0,
                        "product_uom": "Units",
                        "price_unit": 12.0,
                        "price_subtotal": 48.0
                    }
                ],
                "amount_untaxed": 48.0,
                "amount_tax": 0.0,
                "amount_total": 48.0
            }
            ```


###### tags: `Shipping address`


- Create and Delete address is not possible because all address is each user address and each user must have an address. We can only get the Address list( Address for all user), Defualt Address (Current user Address) and update current user address.

- Address list 

    - URL: `odoo_web/mobile/address_list`
    - GET
        - request
            1. None
        - Response
            ```json=
            {
                "partners": [
                    {
                        "street": "123123123",
                        "street2": "123123",
                        "city": "123123",
                        "phone": "0966668587",
                        "email": "leykimteng@gmail.com",
                        "partner_id": 43,
                        "partner_name": "Restaurant"
                    },
                    {
                        "street": "4557 De Silva St",
                        "street2": false,
                        "city": "Fremont",
                        "phone": "(870)-931-0505",
                        "email": "azure.Interior24@example.com",
                        "partner_id": 14,
                        "partner_name": "Azure Interior"
                    },
                    ...
                ]
            }
            ```
            
- Get default address 

    - URL: `odoo_web/mobile/default_address`
    - GET
        - request
            1. user_id: (user_id)
        - Response
            ```json=
            {
                "street": "215 Vine St",
                "street2": "000000000",
                "city": "Scranton",
                "phone": "+1 555-555-5555",
                "email": "admin@yourcompany.example.com",
                "partner_id": 3,
                "partner_name": "Mitchell Admin"
            }
            ```
            
- Update address

    - URL: `odoo_web/mobile/update_address`
    - GET/POST
        - request
            ```json=
            {
                "values": {
                    "street": "215 Vine St",
                    "street2": "000000000",
                    "city": "Scranton",
                    "phone": "+1 555-555-5555",
                    "email": "admin@yourcompany.example.com",
                    ...
                },
                "user_id": (user_id)
            }
            ```
        - Response
            1. if Success: Status 200 with message success
            2. If False: Status 403 (message Update Address Error)
            
###### tags: `Other`

- Search product 

    - URL: `odoo_web/mobile/search_product`
    - GET/POST
        - request
            ```json=
            {
               "kw":"custom"
            }
            ```
        - Response
            ```json=
            {
            
                "products": [
                {
                    "id": 15,
                    "name": "Customizable Desk (CONFIG)",
                    "type": "product",
                    "code": "DESK0004",
                    "categ_id": 8,
                    "categ_name": "Office Furniture",
                    "price": 0.0
                },
                {
                    "id": 71,
                    "name": "Customizable Desk (CONFIG)",
                    "type": "product",
                    "code": "DESK0005",
                    "categ_id": 8,
                    "categ_name": "Office Furniture",
                    "price": 0.0
                },
            ]
            ```
            
- Category list 

    - URL: `odoo_web/mobile/category_list`
    - GET/POST
        - request
            1. None
        - Response
            ```json=
            {
                "categs": [
                    {
                        "id": 1,
                        "name": "All",
                        "parent_id": false,
                        "parent_name": false
                    },
                    {
                        "id": 9,
                        "name": "Consumable",
                        "parent_id": 1,
                        "parent_name": "All"
                    },
                ]
            }
            ```
            
- Sub category list 

    - URL: `odoo_web/mobile/sub_category_list`
    - GET/POST
        - request
            ```json=
            {
               "categ_id":1
            }
            ```
        - Response
            ```json=
            {
                "categs": [
                    {
                        "id": 9,
                        "name": "Consumable"
                    },
                    {
                        "id": 3,
                        "name": "Expenses"
                    },
                    {
                        "id": 4,
                        "name": "Internal"
                    },
                    {
                        "id": 2,
                        "name": "Saleable"
                    }
                ]
            }
            ```
            
- Product list with pagination 

    - URL: `odoo_web/mobile/product_list`
    - GET/POST
        - request
            ```json=
            {
               "page":1, (Not Require)
               "num_per_page": 5, (Require)
               "all": "True" (Not Require use this only when you want to get all product item.)
            }
            ```
        - Response
            ```json=
            {
                "product_list": [
                    {
                        "id": 49,
                        "name": "Whiteboard Pen",
                        "type": "consu",
                        "code": "CONS_0001",
                        "categ_id": 9,
                        "categ_name": "Consumable",
                        "price": 0.0
                    },
                    {
                        "id": 15,
                        "name": "Customizable Desk (CONFIG)",
                        "type": "product",
                        "code": "DESK0004",
                        "categ_id": 8,
                        "categ_name": "Office Furniture",
                        "price": 0.0
                    },
                    {
                        "id": 71,
                        "name": "Customizable Desk (CONFIG)",
                        "type": "product",
                        "code": "DESK0005",
                        "categ_id": 8,
                        "categ_name": "Office Furniture",
                        "price": 0.0
                    },
                    {
                        "id": 72,
                        "name": "Customizable Desk (CONFIG)",
                        "type": "product",
                        "code": "DESK0006",
                        "categ_id": 8,
                        "categ_name": "Office Furniture",
                        "price": 0.0
                    },
                    {
                        "id": 38,
                        "name": "Discount",
                        "type": "consu",
                        "code": "DISC",
                        "categ_id": 10,
                        "categ_name": "PoS",
                        "price": 0.0
                    }
                ],
                "total": 70,
                "num_of_product": 5,
                "current_page": 1,
                "pages": 14,
                "num_per_page": 5
            }
            ```