URL
http://api.fonts.com/rest/{format}/ProjectStyles/
http://api.fonts.com/rest/{format}/ProjectStyles/
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 = $wfs->getProjectKeyByName($my_project_name);
$services->setProjectKey($projectKey);
$result = $services->addStylesheet($stylesheetToken, $selectors);
var_dump($result);
?>
private string AddStylesheet(string projectToken, IEnumerable<string> selectorsList, string projectId, int pageStart, int pageLimit)
{
const string method = "POST";
string requestUri = "/rest/" + Format+ "/ProjectStyles/" +
"?wfspid=" + projectId +
"&wfsptoken=" + projectToken +
"&wfspstart=" + pageStart +
"&wfsplimit=" + pageLimit;
string selectors = selectorsList.Aggregate<string, string>(null, (current, s) => string.Format("{0}, {1}", current, s));
selectors = selectors.Substring(2);
var data = "wfsselector_ids=" + selectors;
//See common functions for GetResponse
return GetResponse(method, requestUri, data);
}
Private Function AddStylesheet(ByVal projectToken As String, ByVal selectorsList As List(Of String), ByVal projectId As String, ByVal pageStart As Integer, ByVal pageLimit As Integer) As String
Const method As String = "POST"
Dim requestUri As String = "/rest/" & Format & "/ProjectStyles/" & _
"?wfspid=" & projectId & _
"&wfsptoken=" & projectToken & _
"&wfspstart=" & pageStart & _
"&wfsplimit=" & pageLimit
Dim selectors As String
selectors = selectorsList.Aggregate(selectors, Function(current, s) String.Format("{0}, {1}", current, s))
selectors = Right(selectors, Len(selectors) - 2) 'remove the first char in string
Dim data = "wfsselector_ids=" & selectors
'See common functions for GetResponse
Return GetResponse(method, requestUri, data)
End Function
<ProjectStyles>
<ProjectID>7bff9927-7964-4f6f-a132-adcae35ad51f</ProjectID>
<Message>Success</Message>
<ProjectStyle>
<SelectorID>3ff4c957-65fd-428d-a53b-3892da0b1960</SelectorID>
<SelectorTag>h1</SelectorTag>
<FontID>691782</FontID>
<FontName>Albertusr Regular</FontName>
<FontPreviewTextLong>Quick Brown Fox Jumped Over The Lazy Dog</FontPreviewTextLong>
<FontFondryName>Monotype Imaging</FontFondryName>
<FontCSSName>Albertus W01</FontCSSName>
<FontLanguage></FontLanguage>
<FontSize></FontSize>
<CDNKey>d44f19a684109620e484147daf90e818082784eafd613082f04a2901e2fc90e07abf26e09077eeb422c4d34d256883d0</CDNKey>
<TTF>9a98ab49-8706-4ba0-9de9-8de54c96bb4c</TTF>
<EOT>39b01d2e-3d63-415e-aaae-408baea01666</EOT>
<SVG>bda30cf7-8011-486d-81f5-d73a7d32e658</SVG>
<WOFF>6605b509-e47b-45a6-8823-67b43b7e594c</WOFF>
<EnableSubsetting>false</EnableSubsetting>
</ProjectStyle>
<TotalRecords>1</TotalRecords>
<PageStart>0</PageStart>
<PageLimit>10</PageLimit>
</ProjectStyles>
{
"ProjectStyles":{
"Message":"Success",
"PageLimit":"10",
"PageStart":"0",
"ProjectID":"7bff9927-7964-4f6f-a132-adcae35ad51f",
"ProjectStyle":{
"CDNKey":"d44f19a684109620e484147daf90e818082784eafd613082f04a2901e2fc90e07abf26e09077eeb422c4d34d256883d0",
"EnableSubsetting":"false",
"EOT":"39b01d2e-3d63-415e-aaae-408baea01666",
"FontCSSName":"Albertus W01",
"FontFondryName":"Monotype Imaging",
"FontID":"691782",
"FontLanguage":null,
"FontName":"Albertusr Regular",
"FontPreviewTextLong":"Quick Brown Fox Jumped Over The Lazy Dog",
"FontSize":null,
"SelectorID":"3ff4c957-65fd-428d-a53b-3892da0b1960",
"SelectorTag":"h1",
"SVG":"bda30cf7-8011-486d-81f5-d73a7d32e658",
"TTF":"9a98ab49-8706-4ba0-9de9-8de54c96bb4c",
"WOFF":"6605b509-e47b-45a6-8823-67b43b7e594c"
},
"TotalRecords":"1"
}
}