Add MX records via API

I can not add the MX record in a Zone from the API of my domain name I’m using PHP sdk with this statement

$dns->addRecord(‘a07e52c68721e…’, ‘MX’, ‘@’, ‘’, 0, false, ‘10’)

And as a result (incomplete by the way)

    GuzzleHttp/Exception/ClientException with message 'Client error: `POST` resulted in a `400 Bad Request` response:
{"success":false,"errors":[{"code":1004,"message":"DNS Validation Error","error_chain":[{"code":9104,"message":"priority  (truncated...)

Any help is welcome

I think you should write like this:
$dns->addRecord(‘a07e52c68721e…’, ‘MX’, ‘@’, ‘’, ‘0’, false, ‘10’)

I am not sure how useful that reply is five months after the OP asked (and hasnt visited again for four months), also in addition the advice is not even correct, TTL is an integer not a string.

The way he is calling the method is correct, the error comes from somewhere else. He truncated the error message but judging from the visible part, coupled with 9076d71, it seems rather the priority was the issue.

1 Like

Hi guys. Fixed the problem! I had this error and solved it by upgrading the SDK version from 1.1 to 1.1.2 in composer.json. This fixed the problem immediately! :slight_smile:

I would suggest VERY useful if the problem + solution were cited… many people get here via search/Google-fu and therefore an answer that works is most appreciated. At least by lil ol me. :wink:

1 Like

Well, then here we go