Domains: Delete A Domain

Collapse All

URL

http://api.fonts.com/rest/{format}/Domains/

{format}

xml or json

Method

DELETE

Required Header Parameters

  • authorizationHashed authorization key
  • appkeyYour application’s key

Required Query String Parameters

  • wfspidThe project id
  • wfsdomain_idDomain id to be deleted

Optional Query String Parameters

  • wfsnopublishThis command automatically calls Publish once it is complete, which takes multiple seconds. To prevent this, use this parameter, set it to 1, and use Publish after all changes are made.
  • wfspstartstarting record requested (zero-based)
  • wfsplimit# of records requested

Response variables

  • MessageIf the response is successful then the “message” parameter of the response will be “Success” and if there is some error or failure then the “message” parameter will be the error message.
  • ProjectIDProject ID
  • Domain: DomainIDThe Identifier for the domain
  • Domain: DomainNameThe domain string
  • TotalRecordsTotal number of records
  • PageStartstarting record requested (zero-based)
  • PageLimit# of records requested

Sample Code

PHP

<?php

require_once('Services_WFS.php');

$services = new Services_WFS;

$apiKey = '[Your API Key]';
$publicKey = '[Your Public Key]';
$privateKey = '[Your Private Key]';
$services->setCredentials($publicKey, $privateKey, $apiKey);

$my_project_name = '[project name]';
$projectKey = $wfs->getProjectKeyByName($my_project_name);
$services->setProjectKey($projectKey);
$services->setAutoPublish(1); // do not auto publish

$result = $services->deleteDomain('domainToBeDeleted.com');
var_dump($result);

?>
      

C#

    private string DeleteDomain(string domainId, string projectId,int publish,  int pageStart = 0, int pageLimit = 10)
    {

      const string method = "DELETE";
      string requestUri = "/rest/" + Format + "/Domains/" + 
                                              "?wfspid=" + projectId + 
                                              "&wfsdomain_id=" + domainId +
                                              "&wfsnopublish=" + publish +
                                              "&wfspstart=" + pageStart + 
                                              "&wfsplimit=" + pageLimit;

      //See common functions for GetResponse
      return GetResponse(method, requestUri);

    }       

VB.NET

  Private Function DeleteDomain(ByVal domainId As String, ByVal projectId As String, ByVal publish As Integer, Optional ByVal pageStart As Integer = 0, Optional pageLimit As Integer = 10) As String

    Const method As String = "DELETE"
    Dim requestUri As String = "/rest/" & Format & "/Domains/" & _
                               "?wfspid=" & projectId & _
                               "&wfsdomain_id=" & domainId & _
                               "&wfsnopublish=" & publish & _
                               "&wfspstart=" & pageStart & _
                               "&wfsplimit=" & pageLimit

    'See common functions for GetResponse
    Return GetResponse(method, requestUri)

  End Function       

xml Response

<Domains>
  <ProjectID>7bff9927-7964-4f6f-a132-adcae35ad51f</ProjectID>
  <Message>Success</Message>
  <Domain>
    <DomainID>748f683b-822a-4212-95bf-597e3e8549db</DomainID>
    <DomainName>*.domain.com</DomainName>
  </Domain>
  <TotalRecords>1</TotalRecords>
  <PageStart>0</PageStart>
  <PageLimit>10</PageLimit>
</Domains>

json Response

{
   "Domains":{
      "Domain":{
         "DomainID":"748f683b-822a-4212-95bf-597e3e8549db",
         "DomainName":"*.domain.com"
      },
      "Message":"Success",
      "PageLimit":"10",
      "PageStart":"0",
      "ProjectID":"7bff9927-7964-4f6f-a132-adcae35ad51f",
      "TotalRecords":"1"
   }
}