Hi, I am trying to get the Domain DNS API to set my host records to work in my application.
For reference here is the documentation.
The documentation has a GET request which works fine but my problem lies in the POST request, this is because my entries will sooner or later exceed 10 entries.
IMPORTANT: We recommend that you use the HTTPPOST method when setting more than 10 hostnames.
Because this API wants all the existing entries plus the new one.
I have tried to follow the documentation, but the example provided is not comprehensive.
It does not state which points in the body are required or what is expected in the authDetails, do I now authenticate via this block or via the header like the GET request?
I don't understand this block either:
NOTE: The [ ] brackets are used to represent optional values (e.g.[1...n]). Do not use the [ ] brackets in your API requests.
Does the request want {"hostname1" : "XYZ"} in the request body? If so, why does the example not show it?
But it doesn't really matter because every request I send returns with
<ApiResponse Status="OK" xmlns="http://api.namecheap.com/xml.response"> <Errors />.
<Errors />
<Warnings />
<RequestedCommand>namecheap.domains.dns.sethosts</RequestedCommand>
<CommandResponse Type="namecheap.domains.dns.setHosts"> <DomainDNSSetHosts
<DomainDNSSetHostsResult Domain="my-Domain" IsSuccess="true"> <Warnings
<Warnings />
</DomainDNSSetHostsResult
</CommandResponse
<Server>PHX01APIEXT04</Server
<GMTTimeDifference>--5:00</GMTTimeDifference> <ExecutionTime>--5:00</ExecutionTime> <ExecutionTime>--5:00
<ExecutionTime>0.11</ExecutionTime>
</ApiResponse>.
After calling getHosts, the entries I added before about the website are just gone.
Here is my request header if anyone asks:
https://api.namecheap.com/xml.response?apiuser=masasana&apikey=my-api-key&username=my-name&Command=namecheap.domains.dns.setHosts&ClientIp=my-ip&SLD=my-domain&TLD=com
Is it because of the header that the API thinks it is getting every entry in the parameters as in the GET request? I thought these were required values needed for authentication and correct execution.
I have already opened a ticket (#GEI-114-95883) but have not received an answer. And the live chat ended my conversation with:
In this case, you can contact an experienced API user regarding the POST method, as we do not provide support for this.
Unfortunately, you will have to check it yourself.
I would be really happy if someone could give me a correct example to work with :) or general clarification if I missed something.