Giải pháp chuyển đổi số trọn gói cho doanh nghiệp Việt

Bổ xung api vào PSApiService - Ví lập trình android quản lý car

Ví lập trình android quản lý car

← Toàn bộ tài liệu


Bước 11: Bổ xung api vào PSApiService

Bài 11/36 Xem dạng sách

Bổ xung xuống cuối nội dung sau vào  interface PSApiService

@Headers({"Authorization:" + Config.API_KEY})
@GET("/api/cars/limit/{limit}/start/{offset}")
Call<ApiResponseGetCarList> getAllCar(@Path("limit") String limit, @Path("offset") String offset);
@FormUrlEncoded
@Headers({"Authorization:" + Config.API_KEY})
@POST("/api_task/car.update_car")
LiveData<ApiResponse<ApiResponseGetCar>> updateCar(
@Query("car_id") String car_id,
@Field("car_name") String car_name,
@Field("car_color") String car_color,
@Field("car_model") String car_model,
@Field("car_description") String car_description


);

@FormUrlEncoded
@Headers({"Authorization:" + Config.API_KEY})
@POST("/api_task/car.insert_car")
LiveData<ApiResponse<ApiResponseGetCar>> insertCar(
@Field("car_name") String car_name,
@Field("car_color") String car_color,
@Field("car_model") String car_model,
@Field("car_description") String car_description


);


@Headers({"Authorization:" + Config.API_KEY, "Content-Type: application/json"})
@GET("api/car/{id}")
LiveData<ApiResponse<ApiResponseGetCar>> getCarById(@Path("id") String id);
@Headers({"Authorization:" + Config.API_KEY, "Content-Type: application/json"})
@POST("/api_task/car.delete_car")
Call<ApiResponseGetDeleteCar> getDeleteCar(
@Query("car_id") String carId
);

 

Sơ đồ quan hệ các bảng

Table Name: {{table.name}}
Num Name Type
{{field_index+1}}
{{field.name}} {{field.type}}

Hỏi đáp (1)

Gửi với tên {{comment_full_name}}
N
Nguyễn Đình Cường 16/08/2023 11:54

Mời anh em vào cào phím nhé. nhớ kiểm tra nguồn điện trước khi cào

Trả lời

Zalo 0936.006.058 Hotline 0936.006.058