michel123 Posted March 12, 2020 Share Posted March 12, 2020 (edited) Bonsoir je suis entre de développer une application androïde qui consomme le web services de prestashop. ma version de prestashop est la 1.7.4.0 actuellement je parvient bien à faire les requêtes de type GET pour l'affichage des catégories et leurs produits. Mon défit est actuelle est de pouvoir faire une requête de type POST pour créer un client. Mais je suis bloqué dépuis deux semaines. j'ai utilisé la doc et les turto juscar présent par d'issu favorable pour moi. voici: @POST("customers?ws_key=ZRCQPZ2IY2ZXKU543AIPT9LE66FBCY4D&io_format=JSON&schema=blank") @Headers({"Content-Type: Application/json", "Accept: application/json","Io-Format: JSON"}) //@FormUrlEncoded //@Multipart Call<ResponseBody> customer( // @Header("Origin") String link, @Header("Authorization") String authorization, @Body Map<String, Object> data ); et l'appel de l API est: ArrayList group=new ArrayList(); group.add(1); Custumer custumers =new Custumer(1,1,1,new Date(), null,null,null,password.getText().toString(), lastname.getText().toString(),fastname.getText().toString(),email.getText().toString(), 1,new Date(),1,null,null,null,null, null,null,null,null,1,null,1,1, 1,new Date(),new Date(),null,null,group); apiAuthenticateService.customer(Utils.API_TOKEN,custumers.toMapp()).enqueue(new Callback<ResponseBody>() { @Override public void onResponse(Call<ResponseBody> call, Response<ResponseBody> response) { Toasty.info(getApplicationContext(),"bomm"); } @Override public void onFailure(Call<ResponseBody> call, Throwable t) { Toasty.info(getApplicationContext(),"orooooo"); } }); chaque exécution, voici l’erreur: D/OkHttp: --> POST https://mcdev.market-express.net/api/customers?ws_key=ZRCQPZ2IY2ZXKU543AIPT9LE66FBCY4D&io_format=JSON&schema=blank http/1.1 Content-Type: Application/json Content-Length: 414 Accept: application/json Io-Format: JSON Authorization: ZRCQPZ2IY2ZXKU543AIPT9LE66FBCY4D {"birthday":"Mar 12, 2020 3:32:09 PM","firstname":"azerti123","is_guest":1,"optin":1,"reset_password_token":"Mar 12, 2020 3:32:09 PM","id_lang":1,"id_gender":1,"id_shop":1,"id":1,"email":"[email protected]","active":1,"lastname":"Werty","date_add":"Mar 12, 2020 3:32:09 PM","newsletter_date_add":"Mar 12, 2020 3:32:09 PM","passwd":"azerty","id_default_group":1,"date_upd":"Mar 12, 2020 3:32:09 PM","id_shop_group":1} --> END POST (414-byte body) D/OkHttp: <-- 404 Not Found https://mcdev.market-express.net/api/customers?ws_key=ZRCQPZ2IY2ZXKU543AIPT9LE66FBCY4D&io_format=JSON&schema=blank (2156ms) Date: Thu, 12 Mar 2020 15:32:18 GMT Content-Type: text/html; charset=utf-8 Vary: Accept-Encoding X-Varnish: 84871698 Age: 0 X-Cache: MISS Connection: close D/OkHttp: <-- END HTTP (1-byte body) merci d'avance pour votre aide Edited March 12, 2020 by michel123 (see edit history) Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now