响应错误“{“status”:400,“title”:null,“detail”:“缺少所需选项\“data\”。”}”

问题描述 投票:0回答:0

我试图通过 PATCH 发送最后一个请求,但它告诉我:{“errors”:{“status”:400,“title”:null,“detail”:“缺少所需的选项“data”。 “ }

这是我的代码:

        $headers_mod = [
            "Authorization" => "Bearer " . $token->access_token,
            "Content_Type" => "application/json", // Change to "application/json" to indicate that the content is JSON
        ];
        $body_mod = [
                    "data"=>[                    
                    "id" => $id_web,
                    "type" => "Leads",
                    "attributes" => [
                        "estado_contacto_c" => $estado
                    
                ]
            ]
        ]; 
        $bod_mod=json_encode($body_mod);
        //dd($body_mod);
        $req_mod = [
            'future' => false,
            'headers' => $headers_mod,
            'debug' => false,
            'body' => $bod_mod // Use the 'json' option to send the body as JSON
        ];
 
        $uri_mod = "https://nextclinics.activalink.com/suitecrm/Api/V8/module";
        $res_mod = $client->request("PATCH", $uri_mod, $req_mod);

我在此请求中需要代码 200。

php guzzle
© www.soinside.com 2019 - 2024. All rights reserved.