Recent Topics

modify customer api address



  • Dear all

    I'm trying to modify the API address for customer but It shows that i have to sent an array which I'm not sure how to do it , in postman

    Screen Shot 2020-04-01 at 12.39.26 PM.png

    even i did as raw still is not accepting it

    {
     
    "id":1,
    "address1":[
    	"abbas tower"
     ],
    "cit":"jabriayh",
    "country":"ksa",
    "country_name": "India",
    "phone": 0123456798,
    "postcode": 248001,
    "state": "UT"
    
    }
    

    please help

    Best regards



  • Hi,
    @cmpengineers

    you should send your data as array type separated by []
    like if you want to send multiple customer name then simply send

    customer_name[] = 'name'
    customer_name[] = 'name2'
    

    for more info visit
    https://stackoverflow.com/questions/12756688/is-it-possible-to-send-an-array-with-the-postman-chrome-extension

    if you still found issue let me know,
    thanks



  • Dear @shivam-webkul

    Still confusing is the adress1 is the only the array? the rest is just regular parameter?

    should you put all of the in address1 array?

    {
     
    "id":1,
    "address1":[
    	"abbas tower"
     ],
    "cit":"jabriayh",
    "country":"ksa",
    "country_name": "India",
    "phone": 0123456798,
    "postcode": 248001,
    "state": "UT"
    
    }
    

    this is your example in bagisto laravel, it shows that address1 is the only array that you need to send?

    so I did the same thing

    Screen Shot 2020-04-01 at 12.39.26 PM.png

    {
     
    "id":1,
    "address1":[
    	"abbas tower"
     ],
    "cit":"jabriayh",
    "country":"ksa",
    "country_name": "India",
    "phone": 0123456798,
    "postcode": 248001,
    "state": "UT"
    
    }
    

    can you just show me how would you do, using the example above to make more sense to me

    Best regards



  • Hi,
    @cmpengineers

    I got your issue , in the address1 is the exploded array string
    Screenshot.png

    if you visit in the directory
    Packages->Webkul->API->Http->resources->CustomerAddress
    then you can see. and if you want to customise any data then simply you can do.

    Thanks.



  • @shivam-webkul said in modify customer api address:

    exploded array string

    @shivam-webkul

    sorry dear still its confusing, at this stage I'm trying just to modify the customer address, and not customize,

    I'm using postman to check the API for bagisto and now I'm stock at modify the customer address

    I don't know how to send the parameter so I can edit the customer address

    I added bracket address1[] it's not working, I tried address1[0] still not working

    Screen Shot 2020-04-01 at 3.09.31 PM.png

    Screen Shot 2020-04-01 at 3.09.36 PM.png

    so I don't know what to send the request in order to edit customer address

    also I don't understand this sentence why address1 not just sending regular request

    request()->merge(['address1' => implode(PHP_EOL, array_filter(request()->input('address1')))]);
    

    it is just one variable why we are using implode with PHP_EOL and array_filter ?

    request()->input('address1');
    

    Best regards



  • Dear @shivam-webkul

    First Thank you very much

    I have solved it in POSTMAN if you want to send an array then you have to choose

    x-www-form-urlencoded or Raw option but Not form-data won't recognize that you are sending an array

    Screen Shot 2020-04-01 at 12.39.26 PM.png

    Best regard


Log in to reply