0

Guys can you help me out that what i am missing in the post request. i don't know why it doesnot update the file. API works fine i have fetched the store detail then i am calling another api to update the store information but something is missed due to which i am unable to update the store information.

uploadImage(
  filepath, filepath1, url) async {
EasyLoading.show(status: 'Uploading Data...');
var request = http.MultipartRequest('POST', Uri.parse(url));
request.fields['store_id'] = store_id;
request.fields['seller_id'] = seller_id;
request.fields['store_live_chat_code'] = " ";
request.fields['store_live_chat_enable'] = " ";
request.fields['store_meta_description'] = " ";
request.fields['store_bank_details'] = " ";
request.fields['store_shipping_type'] = " ";
request.fields['store_shipping_order_type'] = " ";
request.fields['seller_name'] = _sellername.text;
request.fields['store_tin'] = " ";
request.fields['store_seo'] = _seo.text;
request.fields['store_status'] = " ";
request.fields['store_name'] = _storename.text;
request.fields['store_email'] = _selleremail.text;
request.fields['store_phone'] = _storephone.text;
request.fields['store_description'] = _description.text;
request.fields['store_address'] = _storeaddress.text;
request.fields['store_country'] = "99";
request.fields['store_state'] = "1505";
request.fields['store_city'] = cityValue;
request.fields['store_zipcode'] = _storezipcode.text;
request.fields['store_shipping_policy'] = _storeshippingpolicy.text;
request.fields['store_return_policy'] = _storereturnpolicy.text;
request.fields['store_meta_keywords'] = _storemetakeywords.text;
request.fields['store_shipping_charge'] = _shippingcharges.text;
request.fields['store_logo'] = " ";
request.fields['store_banner'] = " ";
request.files.add(await http.MultipartFile.fromPath('thumb', filepath));
request.files.add(await http.MultipartFile.fromPath('banner_thumb', filepath1));
var res = await request.send();
if(res.statusCode==200)
{
  EasyLoading.showSuccess('Data is Uploaded!');
  EasyLoading.dismiss();
  print("API is Working");
  print(res.reasonPhrase);
  Navigator.pop(context);
  // Navigator.pop(context);
}
print(request.fields);
print(filepath);

}

API Parameters PARAMETERS: - POST Request: store_id : Id of Store

seller_id: Id of Seller.

seller_name: Name of Seller

store_live_chat_enable: Store live chat status like yes or no

store_live_chat_code: Store live chat script

store_seo: Search Engine Optimization (SEO) of Store.

store_name: Name of Store.

store_email: Email of Store.

store_phone: Phone of Store.

store_description: Description of Store.

store_address: Address of Store.

store_country: Country of Store.

store_state: State of Store.

store_city: City of Store.

store_zipcode: Area Zipcode of Store.

store_shipping_policy : Policies of Store.

store_return_policy: Product Return Policy.

store_meta_keywords: help to tell search engine what the topic of the page.

store_meta_description: summarizes a page's content down the page link in search engine. store_bank_details: Details of Bank Like Account no. , Branch, IFSC code.

store_tin: Text Id of Store

store_shipping_type: like Flate rate, advanced Shipping.

store_shipping_order_type : Like product_wise, Order Wise.

store_shipping_charge: Shipping chage of a store.

store_status:

store_logo: Logo of Store.

thumb: Path of Logo Directory.

store_banner: Banner of store.

Thumb : Path Of Banner Directory.

Placeholder: Link of Placeholder

Response I am Reciving after posting data API is Working OK {store_id: 1, seller_id: 1, store_live_chat_code: , store_live_chat_enable: , store_meta_description: , store_bank_details: , store_shipping_type: , store_shipping_order_type: , seller_name: Deepak negi, store_tin: , store_seo: Bharat bhuttan, store_status: , store_name: Deepak General Store, store_email: arpit980jaiswal@gmail.com, store_phone: 9807070171, store_description: General Store, store_address: Aliganj Lucknow, store_country: 99, store_state: 1505, store_city: Lucknow, store_zipcode: 226024, store_shipping_policy: test, store_return_policy: test, store_meta_keywords: test, store_shipping_charge: 50, store_logo: , store_banner: } /data/user/0/com.example.seller_app/cache/scaled_image_picker8966774656558794474.jpg

Arpit Jai
  • 211
  • 2
  • 14
  • If you get data from API refer my answer [here](https://stackoverflow.com/a/68709502/13997210) or [here](https://stackoverflow.com/a/68533647/13997210) or [here](https://stackoverflow.com/a/68594656/13997210) hope it's helpful to you – Ravindra S. Patil Sep 24 '21 at 13:09
  • can you call api in postman ? – Wali Khan Sep 24 '21 at 13:10

0 Answers0