0
我已经看过大多数有关他们的prestashop.Some的问题是说,有在这个环节没有API的prestashop.look如何将android应用程序连接到PrestaShop?
http://online.fastchef.in/api/customers/12?output_format=JSON
它给结果JSON form.only事是解析这个form.but仍m到处错误 我的代码:MainActivity
Retrofit retrofit = new Retrofit.Builder()
.baseUrl(API_BASE_URL)
.addConverterFactory(GsonConverterFactory.create(gson))
.build();
int id=Integer.parseInt(mEditText.getText().toString());
PrestaShopClient client =retrofit.create(PrestaShopClient.class);
Call<Customer> hj=client.getCustomer(id);
hj.enqueue(new Callback<Customer>() {
@Override
public void onResponse(Call<Customer> call, Response<Customer> response) {
int status = response.code();
Customer customer = response.body();
mTextView.setText(customer.getFirstname());
}
@Override
public void onFailure(Call<Customer> call, Throwable t) {
}
});
PrestaShopCLient:
public interface PrestaShopClient {
@GET("customers/{id}?output_format=JSON")
Call<Customer> getCustomer(@Path("id") int id);
}
帮我家伙...这个问题我花了一天半次(