Skip to content

REST API

Tatsuro Shibamura edited this page Mar 3, 2021 · 4 revisions

REST API

Important notice

If you only want to use the API externally, disable App Service Authentication and use the Azure Functions Host Key to execute the API.

Issuing flow

  1. Make a POST request to the Add Certificate endpoint
  2. 202 Accepted with Location header is returned.
  3. Execute periodically until the endpoint returned by the Location header returns something other than 202 Accepted.

Add Certificate

Request

POST /api/certificate
X-Functions-Key: <host key is here>

Payload

{
  "AppName": "app-sandbox",
  "ResourceGroupName": "rg-sandbox",
  "SlotName": "production",
  "DnsNames": ["contoso.com", "www.contoso.com"],
  "UseIpBasedSsl": false,
  "ForceDns01Challenge": false
}

Response

202 Accepted
Location: /api/certificate/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
400 Bad Request

{
  "errors": {
    "DnsNames": [
      "The DnsNames is required."
    ]
  },
  "type": "https://tools.ietf.org/html/rfc7231#section-6.5.1",
  "title": "One or more validation errors occurred.",
  "status": 400,
  "traceId": "00-e2468d29d2988e4490e92e2768b622b0-92d30024b7066e4d-00"
}
401 Unauthorized

Add Certificate polling

Request

GET /api/certificate/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
X-Functions-Key: <host key is here>

Response

200 OK
202 Accepted
Location: /api/certificate/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
500 Internal Server Error