URL
http://api.fonts.com/rest/{format}/Selectors/
http://api.fonts.com/rest/{format}/Selectors/
xml or json
PUT
<?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
$fontOnProject = 'ITC Leawood W01 Black';
$result = $services->saveSelector($fontOnProject,'h1.another');
var_dump($result);
?>
private string AssignFontToSelector(string selectorId, string fontId, string projectId,int publish, int pageStart = 0, int pageLimit = 10)
{
const string method = "PUT";
string requestUri = "/rest/" + Format + "/Selectors/" +
"?wfspid=" + projectId +
"&wfsnopublish=" + publish +
"&wfspstart=" + pageStart +
"&wfsplimit=" + pageLimit;
var data = "wfsselector_ids=" + selectorId + "&wfsfont_ids=" + fontId;
//See common functions for GetResponse
return GetResponse(method, requestUri, data);
}
Private Function AssignFontToSelector(ByVal selectorId As String, ByVal fontId 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 = "PUT"
Dim requestUri As String = "/rest/" & Format & "/Selectors/" & _
"?wfspid=" & projectId & _
"&wfsnopublish=" & publish & _
"&wfspstart=" & pageStart & _
"&wfsplimit=" & pageLimit
Dim data = "wfsselector_ids=" & selectorId & _
"&wfsfont_ids=" & fontId
'See common functions for GetResponse
Return GetResponse(method, requestUri, data)
End Function
<Selectors>
<ProjectID>7bff9927-7964-4f6f-a132-adcae35ad51f</ProjectID>
<Message>Success</Message>
<Selector>
<SelectorID>3ff4c957-65fd-428d-a53b-3892da0b1960</SelectorID>
<SelectorTag>h1</SelectorTag>
<SelectorFontID>691782</SelectorFontID>
</Selector>
<TotalRecords>1</TotalRecords>
<PageStart>0</PageStart>
<PageLimit>10</PageLimit>
</Selectors>
{
"Selectors":{
"Message":"Success",
"PageLimit":"10",
"PageStart":"0",
"ProjectID":"7bff9927-7964-4f6f-a132-adcae35ad51f",
"Selector":{
"SelectorFontID":"691782",
"SelectorID":"3ff4c957-65fd-428d-a53b-3892da0b1960",
"SelectorTag":"h1"
},
"TotalRecords":"1"
}
}