cloudflare / cloudflare-php

PHP library for the Cloudflare v4 API
BSD 3-Clause "New" or "Revised" License
621 stars 222 forks source link

Unable to UpdateRecord #111

Closed ponasromas closed 4 years ago

ponasromas commented 5 years ago

I'am unable to update record. Specifically to disable Cloudflare proxy. Code:

$key = new \Cloudflare\API\Auth\APIKey('user@email.tld', '123...');
$adapter = new Cloudflare\API\Adapter\Guzzle($key);
$zones = new \Cloudflare\API\Endpoints\Zones($adapter);
$zoneID = $zones->getZoneID("domain.tld");

$details = [
    'proxied' => false,
];

$recordID = '123...';

$dns = new \Cloudflare\API\Endpoints\DNS($adapter);
$output= $dns->updateRecordDetails($zoneID, '$recordID', $details);

Output:

response: {"success":false,"errors":[{"code":1004,"message":"DNS Validation Error","error_chain":

beltofte commented 5 years ago

Is it working if you do a patch request to the API using Postman or similar tool?

pauladams8 commented 5 years ago

Looking at the error message, it suggests the record you are trying to update is malformed. The full response may provide more details.

haphan commented 4 years ago

@ponasromas $details needs to contain all required fields type, name, content and ttl.

See api doc

ponasromas commented 4 years ago

Issue still not resolved, all details provided. Error:

resulted in a `400 Bad Request` response:
{"result":null,"success":false,"errors":[{"code":9207,"message":"Failed to parse request body...<...>

Request:

$dns->updateRecordDetails($zoneID, $rid, array($type, $name, $content, $ttl, true));

Desired effect: enable Cloudflare proxy.

Result: query failed, record not updated.

Does this API SDK still maintained?

ponasromas commented 4 years ago

Fixed.