shopify api returns status code 400 Bad Request with my php codeigniter app
<p>am able to update product title successfully but when i try making a request to shopify api to update my product image alt i keeps getting status code 400 Bad Request ... here is my code below ... I would be thankful for any help</p>

<pre><code>    public function alt(){

    function __construct() {
            parent::__construct();
            $data = array(); //Always define $data in the constructor to make it available throughout your code
        }

    //getting shop info to access the app
    $store_name = $this-&gt;session-&gt;userdata('store_name');
    $this-&gt;load-&gt;database();
    $this-&gt;load-&gt;model('Store');
    $storeinfo_data=$this-&gt;Store-&gt;load_store_info($store_name);
    $store_name_db = $storeinfo_data-&gt;store_name;
    $store_name_tk = $storeinfo_data-&gt;access_token;
    $store_name_url = $storeinfo_data-&gt;myshopify_domain;
    $this-&gt;data['storeinfo']=$storeinfo_data;               




    if($store_name == $store_name_db){

        //authenticating app with shopify api to be alble to access shop info
    $sc = new ShopifyClient($store_name_url, $store_name_tk, SHOPIFY_KEY, SHOPIFY_SECRET);

    //making a GET request to shopify api for shop products 
    $shop_products = $sc-&gt;call('GET', '/admin/products.json', null);

    foreach($shop_products as $product) {
        $product_id = $product['id'];
        $product_d = $sc-&gt;call('GET', '/admin/products/' . $product_id . '/images.json', null);
        echo "&lt;pre&gt;";
        print_r($product_d);
        $position =  "1";
        $key = "alt";
        $value = "new alt tag content";

        $metafields =  array(
            "key"=&gt;"alt",
            "value"=&gt;"new alt tag content",
            "value_type"=&gt;"string",
            "namespace"=&gt;"tags"
        );

        $image = array(
            "id"=&gt; "16827152131",
            "position" =&gt; 1, 
            "metafields"=&gt;$metafields
        );

        //making a request to update image alt of a product in shop 
        try{
            $shop_product = $sc-&gt;call('PUT','/admin/products/8445495491/images/16827152131.json', $image);
        }catch( Exception $e ){
            echo '&lt;pre&gt;'; 
                print_r($e);

        }
        exit();





    }



    }else{

    }


}
</code></pre>

<p>and here is the output i get </p>

<pre><code>ShopifyApiException Object
(
[method:protected] =&gt; PUT
[path:protected] =&gt; /admin/products/8445495491/images/16827152131.json
[params:protected] =&gt; Array
    (
        [id] =&gt; 16827152131
        [position] =&gt; 1
        [metafields] =&gt; Array
            (
                [key] =&gt; alt
                [value] =&gt; new alt tag content
                [value_type] =&gt; string
                [namespace] =&gt; tags
            )

    )

[response_headers:protected] =&gt; Array
    (
        [http_status_code] =&gt; 400
        [http_status_message] =&gt; Bad Request
        [server] =&gt; nginx
        [date] =&gt; Mon, 26 Sep 2016 09:11:59 GMT
        [content-type] =&gt; application/json; charset=utf-8
        [transfer-encoding] =&gt; chunked
        [connection] =&gt; keep-alive
        [x-frame-options] =&gt; DENY
        [x-shopid] =&gt; 14690858
        [x-shardid] =&gt; 2
        [x-shopify-shop-api-call-limit] =&gt; 1/40
        [http_x_shopify_shop_api_call_limit] =&gt; 1/40
        [x-stats-userid] =&gt; 0
        [x-stats-apiclientid] =&gt; 1423954
        [x-stats-apipermissionid] =&gt; 31527902
        [x-xss-protection] =&gt; 1; mode=block; report=/xss-report/9729121a-c8c6-4ff2-aee8-cb9963cd864f?source%5Baction%5D=update&amp;source%5Bcontroller%5D=admin%2Fproduct_images&amp;source%5Bsection%5D=admin
        [x-request-id] =&gt; 9729121a-c8c6-4ff2-aee8-cb9963cd864f
        [x-dc] =&gt; ash
        [x-download-options] =&gt; noopen
        [x-permitted-cross-domain-policies] =&gt; none
        [x-content-type-options] =&gt; nosniff
    )

[response:protected] =&gt; Array
    (
        [errors] =&gt; Array
            (
                [image] =&gt; Required parameter missing or invalid
            )

    )

[message:protected] =&gt; Bad Request
[string:Exception:private] =&gt; 
[code:protected] =&gt; 400
[file:protected] =&gt; /Applications/MAMP/htdocs/newp/application/libraries/shopify/shopify.class.php
[line:protected] =&gt; 70
[trace:Exception:private] =&gt; Array
    (
        [0] =&gt; Array
            (
                [file] =&gt; /Applications/MAMP/htdocs/newp/application/controllers/platforms/Shopify.php
                [line] =&gt; 347
                [function] =&gt; call
                [class] =&gt; ShopifyClient
                [type] =&gt; -&gt;
                [args] =&gt; Array
                    (
                        [0] =&gt; PUT
                        [1] =&gt; /admin/products/8445495491/images/16827152131.json
                        [2] =&gt; Array
                            (
                                [id] =&gt; 16827152131
                                [position] =&gt; 1
                                [metafields] =&gt; Array
                                    (
                                        [key] =&gt; alt
                                        [value] =&gt; new alt tag content
                                        [value_type] =&gt; string
                                        [namespace] =&gt; tags
                                    )

                            )

                    )

            )

        [1] =&gt; Array
            (
                [file] =&gt; /Applications/MAMP/htdocs/newp/system/core/CodeIgniter.php
                [line] =&gt; 514
                [function] =&gt; alt
                [class] =&gt; Shopify
                [type] =&gt; -&gt;
                [args] =&gt; Array
                    (
                    )

            )

        [2] =&gt; Array
            (
                [file] =&gt; /Applications/MAMP/htdocs/newp/index.php
                [line] =&gt; 315
                [args] =&gt; Array
                    (
                        [0] =&gt; /Applications/MAMP/htdocs/newp/system/core/CodeIgniter.php
                    )

                [function] =&gt; require_once
            )

    )

[previous:Exception:private] =&gt; 
</code></pre>

<p>)</p>