We have a service which can't be discoverable over IPv6 and so we have to reach it over IPv4 always. I'd like to do a Http request over IPv6 to the service on a port 1234 and i want to know what will be the error code cURL throws?
well you are probably going to be running dual stack. So the only way that curl is going to attempt an IPv6 connection is if it is handed an IPv6 address to check. So if you do an DNS lookup and you get an AAAA response, then it will try via IPv6. If it is given an A, it will issue via IPv4.
If you want to force one or the other you can use CURLOPT_IPRESOLVE and the values CURL_IPRESOLVE_V4, CURL_IPRESOLVE_V6, or CURL_IPRESOLVE_WHATEVER to pick one.
As I see it your current issue will only happen if your host lookup returns AAAA records, and then you cannot connect to it over v6. Which to me would mean the service you are monitoring is down/broken.
If you are worried that your transition to V6 is going to cause issues you can always due 2 per service, one with CURL_IPRESOLVE_V4 set, and one with CURL_IPRESOLVE_V6 set. This way you can monitor the service on both Protocols.
Also you might need/want to set options in your monitoring service to indicate if they want you to try IPv6 || IPv4 || both.