Selectors: List Selectors

Collapse All

URL

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

{format}

xml or json

Method

GET

Required Header Parameters

  • authorizationHashed authorization key
  • appkeyYour application’s key

Required Query String Parameters

  • wfspidThe project id

Optional Query String Parameters

  • 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.
  • Selector: SelectorIDThe unique identifier for the selector
  • Selector: SelectorTagThe selector - CSS attribute, ID, class, etc.
  • Selector: SelectorFontIDThe font ID assigned to the selector.
  • 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);


$result = $services->listSelectors();

var_dump($result);

?> 
     

C#

  private string GetListSelectors(string projectId, int pageStart, int pageLimit)
  {

    const string method = "GET";
    string requestUri = "/rest/" + Format  + "/Selectors/" +
                                              "?wfspid=" + projectId + 
                                              "&wfspstart=" + pageStart + 
                                              "&wfsplimit=" + pageLimit;

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

VB.NET

  Private Function GetListSelectors(ByVal projectId As String, ByVal pageStart As Integer, ByVal pageLimit As Integer) As String

    Const method As String = "GET"
    Dim requestUri As String = "/rest/" & Format & "/Selectors/" & _
                               "?wfspid=" & projectId & _
                               "&wfspstart=" & pageStart & _
                               "&wfsplimit=" & pageLimit

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

  End Function

XML Response

<Selectors>
  <ProjectID>7bff9927-7964-4f6f-a132-adcae35ad51f</ProjectID>
  <Message>Success</Message>
  <Selector>
    <SelectorID>3ff4c957-65fd-428d-a53b-3892da0b1960</SelectorID>
    <SelectorTag>h1</SelectorTag>
    <SelectorFontID>0</SelectorFontID>
  </Selector>
  <TotalRecords>1</TotalRecords>
  <PageStart>0</PageStart>
  <PageLimit>10</PageLimit>
</Selectors>

json Response

{
   "Selectors":{
      "Message":"Success",
      "PageLimit":"10",
      "PageStart":"0",
      "ProjectID":"7bff9927-7964-4f6f-a132-adcae35ad51f",
      "Selector":{
         "SelectorFontID":"0",
         "SelectorID":"3ff4c957-65fd-428d-a53b-3892da0b1960",
         "SelectorTag":"h1"
      },
      "TotalRecords":"1"
   }
}