URL
http://api.fonts.com/rest/{format}/Domains/
http://api.fonts.com/rest/{format}/Domains/
xml or json
POST
<?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 = $services->getProjectKeyByName($my_project_name);
$services->setProjectKey($projectKey);
$services->setAutoPublish(1); // do not auto publish
$result = $services->addDomain('newdomain.com');
var_dump($result);
?>
private string AddDomain(string domainName, string projectId, int publish, int pageStart = 0, int pageLimit = 10)
{
const string method = "POST";
string requestUri = "/rest/" + Format + "/Domains/" +
"?wfspid=" + projectId +
"&wfsnopublish=" + publish +
"&wfspstart=" + pageStart +
"&wfsplimit=" + pageLimit;
var data = "wfsdomain_name=" + domainName;
//See common functions for GetResponse
return GetResponse(method, requestUri, data);
}
Private Function AddDomain(ByVal domainName 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 = "POST"
Dim requestUri As String = "/rest/" & Format & "/Domains/" & _
"?wfspid=" & projectId & _
"&wfsnopublish=" & publish & _
"&wfspstart=" & pageStart & _
"&wfsplimit=" & pageLimit
Dim data = "wfsdomain_name=" & domainName
'See common functions for GetResponse
Return GetResponse(method, requestUri, data)
End Function
<Domains>
<ProjectID>7bff9927-7964-4f6f-a132-adcae35ad51f</ProjectID>
<Message>Success</Message>
<Domain>
<DomainID>3afeed21-be68-4a18-94fd-feae5c3443d6</DomainID>
<DomainName>*.example.com</DomainName>
</Domain>
<Domain>
<DomainID>748f683b-822a-4212-95bf-597e3e8549db</DomainID>
<DomainName>*.domain.com</DomainName>
</Domain>
<TotalRecords>2</TotalRecords>
<PageStart>0</PageStart>
<PageLimit>10</PageLimit>
</Domains>
{
"Domains":{
"Domain":[
{
"DomainID":"3afeed21-be68-4a18-94fd-feae5c3443d6",
"DomainName":"*.example.com"
},
{
"DomainID":"748f683b-822a-4212-95bf-597e3e8549db",
"DomainName":"*.domain.com"
}
],
"Message":"Success",
"PageLimit":"10",
"PageStart":"0",
"ProjectID":"7bff9927-7964-4f6f-a132-adcae35ad51f",
"TotalRecords":"2"
}
}