Créer un rapport

POST
https://api.digicert.com/reports/v1/report

Appelez ce point de terminaison pour créer un rapport.

La fonction de bibliothèque de rapports doit être activée sur votre compte pour obtenir une réponse de ce point de terminaison.

cURL
curl --location --request POST 'https://www.digicert.com/services/v1/reports/preview/report' \
--header 'Content-Type: application/json' \
--header 'X-DC-DEVKEY: {{api_key}}' \
--data-raw '{
    "display_name": "Report_1",
    "schedule": {
        "frequency": “MONTHLY", 
        "weekday_to_run": "TUESDAY", 
        "weekday_frequency": "SECOND",  
        "run_until": "2021-12-24" 
    },
    "format": [
      "CSV"  
    ],
    "report_metadata": {
        "report_type": "orders",
        "columns": [
           {
               "identifier": "account_id"
            },
            {
                "identifier": "number_of_sans"
            },
            {
                "identifier": "certificate_id"
            },
            {
                "identifier": "certificate_validity_days"
            },
            {
                "identifier": "container_id"
            },
            {
                "identifier": "container_name"
            } 
        ],
       "filters":[
        {
        "filter_identifier":"in",
        "column_identifier":"common_name",
        "values":["digiqatest.com"]
        },
        {
        "filter_identifier":"in",
        "column_identifier":"organization_name",
        "values":["win the customer, LLC"]
        },
        {
        "filter_identifier":"in",
        "column_identifier":"status",
        "values":["issued","pending"]
        },
        {
        "filter_identifier":"in",
        "column_identifier":"user_email",
        "values":["dev1@digicert.com"]
        },
        {
        "filter_identifier":"in",
        "column_identifier":"product_name",
        "values":["Secure Site Pro SSL","GeoTrust TrueBusiness ID OV","Secure Site OV"]
        },
        {
        "filter_identifier":"in",
        "column_identifier":"order_placed_via",
        "values":["CertCentral","Api"]
        },
        {
        "filter_identifier":"last_30_days",
        "column_identifier":"order_created_date",
        "values":[]
        },
        {
        "filter_identifier":"in",
        "column_identifier":"certificate_id",
        "values":[3292682707,3292682692,3292682697]
        }
    ],
    "sources": {
      "include_all_sub_accounts": true,
      "sub_accounts": [],
      "divisions":[]
    }        
    }
}
Python
import requests

url = "https://www.digicert.com/services/v1/report"

payload="{\r\n    \"display_name\": \"Report_1\",\r\n    \"schedule\": {\r\n        \"frequency\": “MONTHLY\", \r\n        \"weekday_to_run\": \"TUESDAY\", \r\n        \"weekday_frequency\": \"SECOND\",  \r\n        \"run_until\": \"2021-12-24\" \r\n    },\r\n    \"format\": [\r\n      \"CSV\"  \r\n    ],\r\n    \"report_metadata\": {\r\n        \"report_type\": \"orders\",\r\n        \"columns\": [\r\n           {\r\n               \"identifier\": \"account_id\"\r\n            },\r\n            {\r\n                \"identifier\": \"number_of_sans\"\r\n            },\r\n            {\r\n                \"identifier\": \"certificate_id\"\r\n            },\r\n            {\r\n                \"identifier\": \"certificate_validity_days\"\r\n            },\r\n            {\r\n                \"identifier\": \"container_id\"\r\n            },\r\n            {\r\n                \"identifier\": \"container_name\"\r\n            } \r\n        ],\r\n       \"filters\":[\r\n        {\r\n        \"filter_identifier\":\"in\",\r\n        \"column_identifier\":\"common_name\",\r\n        \"values\":[\"digiqatest.com\"]\r\n        },\r\n        {\r\n        \"filter_identifier\":\"in\",\r\n        \"column_identifier\":\"organization_name\",\r\n        \"values\":[\"win the customer, LLC\"]\r\n        },\r\n        {\r\n        \"filter_identifier\":\"in\",\r\n        \"column_identifier\":\"status\",\r\n        \"values\":[\"issued\",\"pending\"]\r\n        },\r\n        {\r\n        \"filter_identifier\":\"in\",\r\n        \"column_identifier\":\"user_email\",\r\n        \"values\":[\"dev1@digicert.com\"]\r\n        },\r\n        {\r\n        \"filter_identifier\":\"in\",\r\n        \"column_identifier\":\"product_name\",\r\n        \"values\":[\"Secure Site Pro SSL\",\"GeoTrust TrueBusiness ID OV\",\"Secure Site OV\"]\r\n        },\r\n        {\r\n        \"filter_identifier\":\"in\",\r\n        \"column_identifier\":\"order_placed_via\",\r\n        \"values\":[\"CertCentral\",\"Api\"]\r\n        },\r\n        {\r\n        \"filter_identifier\":\"last_30_days\",\r\n        \"column_identifier\":\"order_created_date\",\r\n        \"values\":[]\r\n        },\r\n        {\r\n        \"filter_identifier\":\"in\",\r\n        \"column_identifier\":\"certificate_id\",\r\n        \"values\":[3292682707,3292682692,3292682697]\r\n        }\r\n    ],\r\n    \"sources\": {\r\n      \"include_all_sub_accounts\": true,\r\n      \"sub_accounts\": [],\r\n      \"divisions\":[]\r\n    }        \r\n    }\r\n}"
headers = {
  'Content-Type': 'application/json',
  'X-DC-DEVKEY': '{api_key}',
  'Cookie': 'visid_incap_1323850=KAk7FceETTODSOcubQ6RxzER+V8AAAAAQUIPAAAAAACT+abPwAMvJuYXiY7OiuId'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)
Go
package main

import (
  "fmt"
  "strings"
  "net/http"
  "io/ioutil"
)

func main() {

  url := "https://www.digicert.com/services/v1/report"
  method := "POST"

  payload := strings.NewReader(`{`+"
"+`
    "display_name": "Report_1",`+"
"+`
    "schedule": {`+"
"+`
        "frequency": “MONTHLY", `+"
"+`
        "weekday_to_run": "TUESDAY", `+"
"+`
        "weekday_frequency": "SECOND",  `+"
"+`
        "run_until": "2021-12-24" `+"
"+`
    },`+"
"+`
    "format": [`+"
"+`
      "CSV"  `+"
"+`
    ],`+"
"+`
    "report_metadata": {`+"
"+`
        "report_type": "orders",`+"
"+`
        "columns": [`+"
"+`
           {`+"
"+`
               "identifier": "account_id"`+"
"+`
            },`+"
"+`
            {`+"
"+`
                "identifier": "number_of_sans"`+"
"+`
            },`+"
"+`
            {`+"
"+`
                "identifier": "certificate_id"`+"
"+`
            },`+"
"+`
            {`+"
"+`
                "identifier": "certificate_validity_days"`+"
"+`
            },`+"
"+`
            {`+"
"+`
                "identifier": "container_id"`+"
"+`
            },`+"
"+`
            {`+"
"+`
                "identifier": "container_name"`+"
"+`
            } `+"
"+`
        ],`+"
"+`
       "filters":[`+"
"+`
        {`+"
"+`
        "filter_identifier":"in",`+"
"+`
        "column_identifier":"common_name",`+"
"+`
        "values":["digiqatest.com"]`+"
"+`
        },`+"
"+`
        {`+"
"+`
        "filter_identifier":"in",`+"
"+`
        "column_identifier":"organization_name",`+"
"+`
        "values":["win the customer, LLC"]`+"
"+`
        },`+"
"+`
        {`+"
"+`
        "filter_identifier":"in",`+"
"+`
        "column_identifier":"status",`+"
"+`
        "values":["issued","pending"]`+"
"+`
        },`+"
"+`
        {`+"
"+`
        "filter_identifier":"in",`+"
"+`
        "column_identifier":"user_email",`+"
"+`
        "values":["dev1@digicert.com"]`+"
"+`
        },`+"
"+`
        {`+"
"+`
        "filter_identifier":"in",`+"
"+`
        "column_identifier":"product_name",`+"
"+`
        "values":["Secure Site Pro SSL","GeoTrust TrueBusiness ID OV","Secure Site OV"]`+"
"+`
        },`+"
"+`
        {`+"
"+`
        "filter_identifier":"in",`+"
"+`
        "column_identifier":"order_placed_via",`+"
"+`
        "values":["CertCentral","Api"]`+"
"+`
        },`+"
"+`
        {`+"
"+`
        "filter_identifier":"last_30_days",`+"
"+`
        "column_identifier":"order_created_date",`+"
"+`
        "values":[]`+"
"+`
        },`+"
"+`
        {`+"
"+`
        "filter_identifier":"in",`+"
"+`
        "column_identifier":"certificate_id",`+"
"+`
        "values":[3292682707,3292682692,3292682697]`+"
"+`
        }`+"
"+`
    ],`+"
"+`
    "sources": {`+"
"+`
      "include_all_sub_accounts": true,`+"
"+`
      "sub_accounts": [],`+"
"+`
      "divisions":[]`+"
"+`
    }        `+"
"+`
    }`+"
"+`
}`)

  client := &http.Client {
  }
  req, err := http.NewRequest(method, url, payload)

  if err != nil {
    fmt.Println(err)
    return
  }
  req.Header.Add("Content-Type", "application/json")
  req.Header.Add("X-DC-DEVKEY", "{api_key}")
  req.Header.Add("Cookie", "visid_incap_1323850=KAk7FceETTODSOcubQ6RxzER+V8AAAAAQUIPAAAAAACT+abPwAMvJuYXiY7OiuId")

  res, err := client.Do(req)
  if err != nil {
    fmt.Println(err)
    return
  }
  defer res.Body.Close()

  body, err := ioutil.ReadAll(res.Body)
  if err != nil {
    fmt.Println(err)
    return
  }
  fmt.Println(string(body))
}
NodeJS
var request = require('request');
var options = {
  'method': 'POST',
  'url': 'https://www.digicert.com/services/v1/report',
  'headers': {
    'Content-Type': 'application/json',
    'X-DC-DEVKEY': '{api_key}',
    'Cookie': 'visid_incap_1323850=KAk7FceETTODSOcubQ6RxzER+V8AAAAAQUIPAAAAAACT+abPwAMvJuYXiY7OiuId'
  },
  body: '{\r\n    "display_name": "Report_1",\r\n    "schedule": {\r\n        "frequency": “MONTHLY", \r\n        "weekday_to_run": "TUESDAY", \r\n        "weekday_frequency": "SECOND",  \r\n        "run_until": "2021-12-24" \r\n    },\r\n    "format": [\r\n      "CSV"  \r\n    ],\r\n    "report_metadata": {\r\n        "report_type": "orders",\r\n        "columns": [\r\n           {\r\n               "identifier": "account_id"\r\n            },\r\n            {\r\n                "identifier": "number_of_sans"\r\n            },\r\n            {\r\n                "identifier": "certificate_id"\r\n            },\r\n            {\r\n                "identifier": "certificate_validity_days"\r\n            },\r\n            {\r\n                "identifier": "container_id"\r\n            },\r\n            {\r\n                "identifier": "container_name"\r\n            } \r\n        ],\r\n       "filters":[\r\n        {\r\n        "filter_identifier":"in",\r\n        "column_identifier":"common_name",\r\n        "values":["digiqatest.com"]\r\n        },\r\n        {\r\n        "filter_identifier":"in",\r\n        "column_identifier":"organization_name",\r\n        "values":["win the customer, LLC"]\r\n        },\r\n        {\r\n        "filter_identifier":"in",\r\n        "column_identifier":"status",\r\n        "values":["issued","pending"]\r\n        },\r\n        {\r\n        "filter_identifier":"in",\r\n        "column_identifier":"user_email",\r\n        "values":["dev1@digicert.com"]\r\n        },\r\n        {\r\n        "filter_identifier":"in",\r\n        "column_identifier":"product_name",\r\n        "values":["Secure Site Pro SSL","GeoTrust TrueBusiness ID OV","Secure Site OV"]\r\n        },\r\n        {\r\n        "filter_identifier":"in",\r\n        "column_identifier":"order_placed_via",\r\n        "values":["CertCentral","Api"]\r\n        },\r\n        {\r\n        "filter_identifier":"last_30_days",\r\n        "column_identifier":"order_created_date",\r\n        "values":[]\r\n        },\r\n        {\r\n        "filter_identifier":"in",\r\n        "column_identifier":"certificate_id",\r\n        "values":[3292682707,3292682692,3292682697]\r\n        }\r\n    ],\r\n    "sources": {\r\n      "include_all_sub_accounts": true,\r\n      "sub_accounts": [],\r\n      "divisions":[]\r\n    }        \r\n    }\r\n}'

};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});
201 Created
{
  "report_identifier": "e62b02f3-97f9-4fa1-9314-f9ecfdcaf5d7",
  "message": "Successfully created Custom Report"
}
400 Bad request
{
"code": "missing_mandatory_fields",
"message": "Please provide values for mandatory fields"
}
400 Invalid request
{
"code": "invalid_request",
"message": "Please provide correct input for fields: [|display_name has an invalid value|]"
}
400 Already exists
{ 
   "code": "report_exists", 
   "message": "Report already exists"
}
400 Missing field
{
"code": "missing_mandatory_fields",
"message": "Please provide values for mandatory fields"
}
400 Invalid value
{
"code": "invalid_request",
"message": "Please provide correct input for fields: [|run_until has an invalid value|]"
}
400 Invalid date
{
"code": "invalid_date",
"message": "Backdated run_until is not allowed"
}
400 Format unsupported
{
"code": "report_format_inapplicable",
"message": "The given report format is not applicable for the template/report."
}
400 Missing format
{
"code": "missing_mandatory_fields",
"message": "Please provide values for mandatory fields"
}
400 Empty format
{
"code": "invalid_request",
"message": "Please provide correct input for fields: [|format must contain at least 1 item|]"
}
400 Invalid report type
{
"code": "invalid_report_type",
"message": "Invalid report_type specified"
}
400 Invalid column
{
"code": "invalid_column_identifiers",
"message": "Invalid column identifiers specified"
}
400 Invalid schedule
{
"code": "invalid_schedule",
"message": "Provided schedule values are not correct"
}
401 Invalid user
{
"code": "user_authentication_error",
"message": "User is not authenticated."
}
403 Forbidden
{
    "code": "user_forbidden",
    "message": "User does not have the required permission."
}
403 Not enabled
{
    "code": "custom_reports_not_enabled",
    "message": "Custom reports is not enabled"
}

Paramètres de demande

Nom Obligatoire/facultatif Type Description
display_name Obligatoire string Nom à afficher sur le rapport.
schedule Obligatoire object Conteneur.
.. frequency Obligatoire string Fréquence de la création de rapport. Valeurs possibles : ON_DEMAND, WEEKLY, MONTHLY. Ces valeurs sont sensibles à la casse.
.. weekday_to_run Obligatoire string Jour de la semaine auquel créer le rapport. Valeurs possibles : Du SUNDAY au SATURDAY. Ces valeurs sont sensibles à la casse. Ce paramètre n’est pas nécessaire si la frequency est indiquée comme ON_DEMAND.
.. weekday_frequency Obligatoire string Semaine du mois spécifiée pour la génération du rapport. Valeurs possibles : FIRST, SECOND, THIRD, FOURTH, LAST. Ces valeurs sont sensibles à la casse.
.. run_until Facultatif date Date à laquelle arrêter la génération de ce rapport. Format : AA-MM-JJ. Si aucune valeur n’est spécifiée, la création du rapport ne s'arrête jamais.
format Obligatoire string Type de fichier du rapport. Valeurs possibles : CSV et JSON.
report_metadata Obligatoire object Conteneur
.. report_type Obligatoire string Type de rapport à créer.
.. columns Obligatoire object Conteneur.
.. .. identifier Obligatoire string L’identificateur de colonne pris en charge par l’API Bibliothèque de rapports Pour obtenir la liste de toutes les colonnes prises en charge, consultez la page Colonnes de l’API Bibliothèque de rapports.
.. filters Facultatif object Conteneur.
.. .. filter_identifier Obligatoire string Identificateur à utiliser pour le filtrage. Pour plus d'informations sur l’utilisation des filtres, consultez la page « Créer des rapports de bibliothèque avec filtres ».
.. .. column_identifier Obligatoire string Identificateurs de colonne spécifiés, à utiliser pour le filtrage. Pour plus d'informations sur l’utilisation des filtres, consultez la page « Créer des rapports de bibliothèque avec filtres ».
.. .. values Obligatoire string/lint Valeurs spécifiées dans les colonnes, à utiliser pour le filtrage. Pour plus d'informations sur l’utilisation des filtres, consultez la section « Créer des rapports de bibliothèque avec filtres ».
.. sources Facultatif object Conteneur.
.. .. include_all_sub_accounts Obligatoire boolean Faut-il inclure ou non tous les sous-comptes dans la création du rapport. Valeurs possibles : TRUE ou FALSE.
.. .. sub_accounts Obligatoire integer Identifiant du sous-compte à fournir afin de l'inclure dans la création du rapport.
.. .. divisions Obligatoire integer Division du compte à inclure dans la création du rapport.

Paramètres de réponse

Nom Type Description
.. report_identifier uuid Identifiant du rapport
.. message string Message indiquant que la création a réussi, incluant le nom d'affichage du rapport.