# DNS Provider

# Gandi

curl -H"Authorization: Apikey $APIKEY" \
  "https://api.gandi.net/v5/organization/organizations\?type=company" \
  | jq '.[].id'
1
2
3

# Back up domains

List all domains

curl -H"X-Api-Key: $APIKEY" \
  https://dns.api.gandi.net/api/v5/domains\?sharing_id\=$SHARING_ID \
  | jq -r '.[].fqdn' \
  > domain.list
1
2
3
4

Copy data
For each records in a given domain get all records info (type, ttl, name, href, values) and create.

mkdir domains_records

while read domain; do
  (curl -H"X-Api-Key: $APIKEY" \
    https://dns.api.gandi.net/api/v5/domains/$domain/records\?sharing_id\=$SHARING_ID \
    | jq . > ./domains_records/$domain) &
done <domain.list
1
2
3
4
5
6
7

# Ovh

# API

Example : You want to use Let's encrypt certbot wildcard domain certificate generation + auto renewal
The certbot docopen in new window ask you to have the following acces to the OVH api (if your DNS provider is ovh obviously, it depends)

  • GET /domain/zone/*
  • PUT /domain/zone/*
  • POST /domain/zone/*
  • DELETE /domain/zone/*

Then, you need 3 credetntialsopen in new window
Example credentials file:

# OVH API credentials used by Certbot
dns_ovh_endpoint = ovh-eu
dns_ovh_application_key = MDAwMDAwMDAwMDAw
dns_ovh_application_secret = MDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAw
dns_ovh_consumer_key = MDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAw
1
2
3
4
5
  1. Creation of your application keys (1/3 & 2/3)

Authentication consists of two keys. The first is the application key. Any application wanting to communicate with the OVH API must be declared in advance.

Click on the following link: https://eu.api.ovh.com/createApp/, enter your customer ID, your password, and the name of your application. The name will be useful later if you want to allow others to use it.

You get two keys:

the application key

7kbG7Bk7S9Nt7ZSV
1

your secret application key

EXEgWIz07P0HYwtQDs7cNIqCiQaWSuHF
1
  1. Get your consumer key (3/3)
curl -XPOST -H"X-Ovh-Application: 7kbG7Bk7S9Nt7ZSV" -H "Content-type: application/json" \
https://eu.api.ovh.com/1.0/auth/credential  -d '{
  "accessRules": [
    {
      "method": "DELETE",
      "path": "/domain/zone/*"
    },
    {
      "method": "GET",
      "path": "/domain/zone/*"
    },
    {
      "method": "POST",
      "path": "/domain/zone/*"
    },
    {
      "method": "PUT",
      "path": "/domain/zone/*"
    }
  ],
  "redirection": null
}' | \
jq
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
{
  "validationUrl": "https://eu.api.ovh.com/auth/?credentialToken=iQ1joJE0OmSPlUAoSw1IvAPWDeaD87ZM64HEDvYq77IKIxr4bIu6fU8OtrPQEeRh",
  "consumerKey": "MtSwSrPpNjqfVSmJhLbPyr2i45lSwPU1",
  "state": "pendingValidation"
}
1
2
3
4
5

Doc of this endpointopen in new window

  1. Validate your consumer key
    Connect the authentication token to an OVH customer account In the response, you will be sent a validation URL and a consumerKey (the token, named CK). This token is not initially linked to any customer. You (or another customer) will connect your OVH account to this token by logging in using the URL.

This stage will enable you to identify any OVH customer and to obtain rights on their account. This could be useful if you want to develop an app for the community. Otherwise you can log in directly on the page.

Go here (example) : https://eu.api.ovh.com/auth/?credentialToken=iQ1joJE0OmSPlUAoSw1IvAPWDeaD87ZM64HEDvYq77IKIxr4bIu6fU8OtrPQEeRh