Authentication

The Site Serve API uses OAuth 2.0 Authentication Protocol to allow access to the various methods. You need to use your access_token with each API request. The access token is valid for 1 hour and needs to be refreshed. You can use the refresh_token to regenerate a new access_token.

The API is accessible at:

https://api.kyndryl.eightbarcollective.com

The sandbox is a virtual testing environment that mimics the production API methods. It provides a self-contained space where you can initiate and test your integrations to the SiteServe APIs without changing any live data. Its highly recommended that you start your integration using the sandbox and move to production once you have tested the integrations. The sandbox endpoint is available at:

https://api-sandbox.kyndryl.eightbarcollective.com

Generating the Authorization Token

The authorization token can be generate by a GET request to the below endpoint.

Endpoint
GET /oauth/authorize?response_type=code
                      &client_id=YOUR_CLIENT_ID
                      &redirect_uri=/oauth/receivecode
                      &state=RANDOM_NUMBER

This will display an auth_code on the screen. This authorization token can be then used to generate the access_token and the refresh_token. Please note that the access_token is only valid of 1 hour.

Parameters
Parameter Type Required? Description
client_id string required Consumer Key provided to you when you signed up.
redirect_uri string required The URL where you would be redirected after you have successfully authorized access. If you do not have access to a browser, you must set this to inapp.
response_type string required Must be the string code.
state string required Your client can insert state information that will be appended to the redirect_uri upon success user authorization.

Generating the Access Token

Endpoint
Accept: application/json
Content-Type: application/json

POST /oauth
Parameters
Parameter Type Required? Description
client_id string required Consumer Key provided to you when you signed up.
client_secret string required The Consumer Secret provided to you when you signed up.
redirect_uri string required The URL where you would be redirected after you have successfully authorized access. If you do not have access to a browser, you must set this to inapp. If inapp is used as the redirect_uri, the access_token will never expire.
code string required The authorization_token that you have received from the first step
grant_type string required Must contain the string authorization_code grant type.
Request Body
{
    "redirect_uri":"/oauth/receivecode",
    "client_id":"YOUR_CLIENT_ID",
    "client_secret":"YOUR_ACCOUNT_PASSWORD",
    "code":"AUTHORIZATION_TOKEN"",
    "grant_type":"authorization_code"
}
Response Body
{
    "access_token":"bf60c59ea896b46885de91307a3888bd6fe0259f",
    "expires_in":3600,
    "token_type":"Bearer",
    "scope":null,
    "refresh_token":"393b4061d46ed7b95004e60fc76601ed185b9a08"
}
Response Parameters
Parameter Type Description
access_token string The access token generated by the system for your account.
expires_in integer The time in seconds for which the access token is valid. The default value is 3600.
token_type string The type of the token generated. The default type is Bearer.
scope string The scope of access for the access_token
refresh_token string The refresh token that you can use to acquire a new access token after the current one expires.

Refresh Tokens

Key points to consider when working with refresh tokens:

  • Refresh tokens will not expire. They can only be invalidated explicitly by the user.
  • As a best practice, you should always capture the refresh token after using it to get a new access token. It may change, and when it does you should use the new one.
  • If you change your password, the existing refresh token should continue to work.

Refreshing the Access Token using the Refresh Token

You can use the refresh_token to regenerate a new access_token. As noted above

Endpoint
Accept: application/json
Content-Type: application/json

POST /oauth
Parameters
Parameter Type Required? Description
client_id string required Consumer Key provided to you when you signed up.
client_secret string required The Consumer Secret provided to you when you signed up.
grant_type string required Must contain the refresh_token grant type.
refresh_token string required The refresh_token provided to you in the first step
Request Body
{
    "grant_type":"refresh_token",
    "refresh_token":"393b4061d46ed7b95004e60fc76601ed185b9a08",
    "client_id":"testclient",
    "client_secret":"testpass"
}
Response Body
{
    "access_token":"6d8db05ac28b38d29a1ec32f401753469ec35869",
    "expires_in":3600,
    "token_type":"Bearer",
    "scope":null
}
Response Parameters
Parameter Type Description
access_token string The access token generated by the system for your account.
expires_in integer The time in seconds for which the access token is valid. The default value is 3600.
token_type string The type of the token generated. The default type is Bearer.
scope string The scope of access for the access_token

Accessing the API

Uploading Leads

Leads can be imported by using the SiteServe Upload API. This API supports bulk operations.

Endpoint
Authorization: Bearer YOUR_ACCESS_TOKEN
Accept: application/json
Content-Type: application/json

POST /siteserve/upload
Parameters

Please make sure that the 4 first fields described below are exactly matching the IO provided by the Agency Planning team, otherwise none of the rest of the data will be accepted.

Parameter Type Required? Description
campaign_id string required The Campaign ID for which the lead was captured. Assigned by EightBar, cannot be changed.
campaign_name string required The campaign name for which the lead was captured. Assigned by EightBar, cannot be changed.
publisher_id string required The Publisher ID (Site Name/Code) for which the lead was captured. Assigned by EightBar, cannot be changed.
placement_name string required The placement name for which the lead was captured. Assigned by EightBar, cannot be changed.
source_site string required Web page or Agency Sourcing
unique_order_number string required A Unique ID for each person registering defined by you, for each Campaign and Placement combination. Please note that this number has to be different than previously uploaded numbers (for the specific campaign/placement combination the lead is getting uploaded against), otherwise the lead information will not be accepted.
title string optional Salutation of the lead. For example, Mr., Mr, Ms, Dr..
first_name string required First name of the lead
middle_name string optional Middle name of the lead
last_name string required Last name of the lead
job_title string required Job title of the lead
department string optional Department / Business Unit of the lead
company string required Company with which the lead is associated with.
company_size string required Size of the company
address_line_1 string required Address Line 1
address_line_2 string optional Address Line 2
address_line_3 string optional Address Line 3
city string required City name of the lead
state string required if country is US or CA 2 digit state/province code of the lead. State information is only required for leads in US. Click here to see a list of all states and their codes.
zip_code string required Zip code of the lead. For US, no dashes or periods just numbers.
country string required Country code of the lead. Click here to see a list of all countries and their codes.
phone string required Phone number of the lead. No dots, dashes or spaces, just numbers.
extension string optional Honorific extension added to the name like Jr., Sr., etc.
fax string optional FAX number of the lead
email string required Email address of the lead
ts_received string optional Time Stamp the lead was received by the system
geography string optional Geographical classification of the lead's location
ov_code string required OV Codes as confirmed by EightBar.(Can accept only alphanumeric values with max length 10)
ww_score string optional World-wide Score
custinfo1 string optional Custom Information about the lead
custinfo2 string optional Custom Information about the lead
privacy string optional Privacy setting opted by the lead
tactic string required Tactic code of the placement
response_type string required Response type. Allowed values can be: WEBRESP, REGSTRD or ATTND.
asset_name string optional Asset name
questionnum1_ooemail string required Allowed values can be Q_XSYS:OOEMAIL or Q_XSYS:OIEMAIL
email_verification string required Status of the verification of the email address. Allowed values can be CHECKED or NOT CHECKED.
questionnum2_ootele string required Allowed values can be Q_XSYS:OOTELE or Q_XSYS:OITELE
phone_verification string required Status of the verification of the phone number. Allowed values can be CHECKED or NOT CHECKED.
questionnum3_oopostal string required Allowed values can be Q_XSYS:OOPOSTAL or Q_XSYS:OIPOSTAL
zipcode_verification string required Status of the verification of the zip code. Allowed values can be CHECKED or NOT CHECKED.
timestamp string required Time Stamp the lead was received by your system.
question_[n] string optional Optional question asked in the form. The [n] defines the number of the question. For example - question_1, question_2 and so on.
answer_[n] string optional Answers to the optional questions. Please note that the answers should have the same numbers are their questions. For example - question_1 should have answer_1.
offer_code string required (For Unica 9.1) The offer code provided by EightBar
channel string required (For Unica 9.1) The channel from which the lead is generated. Valid values are Digital Inbound:Content Syndication, Event:Virtual or Event:Face to Face.
interaction_type string required (For Unica 9.1) The type of interation the lead had. Allowed values can be ATTND, REGSTRD or CONTSYND.
Request Body

A JSON array of one or more leads can be submitted using the POST method to this API.

[
    {
        "campaign_id":"163051",
        "campaign_name":"2010 Q4|IBM_Non-CA_IT_Rational CS|NonIntel|NYC|USA",
        "publisher_id":"I/EMEDIA (00104221)",
        "placement_name":"AVIATION WEEK|Systems - Content Syndication|0x0",
        "source_site":"TECHTARGET",
        "unique_order_number":"23",
        "title":"Mr",
        "first_name":"John",
        "middle_name":"E.",
        "last_name":"Smith",
        "job_title":"CEO",
        "company":"Acne Corporation",
        "company_size":"250 to 499",
        "address_line_1":"address line 1",
        "address_line_2":"address line 2",
        "address_line_3":"address line 3",
        "city":"New York City",
        "state":"NY",
        "zip_code":"10021",
        "country":"US",
        "phone":"9876543210",
        "fax":"9876543211",
        "email":"john.smith12@company.com",
        "ts_received":"2015-03-01 23:13:19",
        "extension":"Jr.",
        "department":"department name",
        "geography":"cgeography",
        "ov_code":"OV124881",
        "ww_score":"wwscore",
        "custinfo1":"customer info 1",
        "custinfo2":"customer info 2",
        "privacy":"cprivacy",
        "tactic":"C39103UX",
        "response_type":"WEBRESP",
        "asset_name":"assetname",
        "questionnum1_ooemail":"Q_XSYS:OOEMAIL",
        "email_verification":"CHECKED",
        "questionnum2_ootele":"Q_XSYS:OOTELE",
        "phone_verification":"CHECKED",
        "questionnum3_oopostal":"Q_XSYS:OOPOSTAL",
        "zipcode_verification":"NOT CHECKED",
        "timestamp":"2014-03-21 11:38:52"
    }
]
Response Body

The API will send a response to the calls in JSON format.

{
    "response":{
        "code": 200,
        "request_id":"d65613aa069c45469f0b9e1b5efa1863",
        "status":"Success",
        "submitted_leads":1,
        "uploaded_leads":1,
        "duplicate_leads":0,
        "invalid_leads":0
    }
}
Response Parameters
Parameter Type Required? Description
request_id string The system generated ID for the submitted request which can be later used to get the status of the request. This is particularly useful in case of bulk lead imports.
status string The initial status of the request from the server. If the request was successful, it will return Success and if the request failed, it will return Failed. If you have submitted a large number of leads, the system may put it into batch processing. In that case, the status of the request would be returned as Pending.
submitted_leads integer The number of the leads submitted in the request.
uploaded_leads integer The number of leads successfully imported by the system.
duplicate_leads integer The number of duplicate leads in the request. A duplicate lead is defined as an email address already existing in the system for a particular campaign and placement.
invalid_leads integer The number of invalid leads submitted in the request. An invalid lead is classified as a lead with an invalid email address, incorrect placement/campaign mapping, invalid zip code and/or missing data for required fields.
errors array (optional) An array of error messages will ONLY appear if there are any duplicate or invalid leads. It will contain the reason for each of the duplicate and/or invalid leads.
    Assertion: submitted_leads = uploaded_leads + duplicate_leads + invalid_leads

Getting the Status of a Request

If you have submitted multiple leads and the initial status in the response is pending, you can use the SiteServe Status API to get the updated status at any time. As a best practice, you should store the request IDs generated by the system for the requests made by your application.

Endpoint
Authorization: Bearer YOUR_ACCESS_TOKEN
Accept: application/json
Content-Type: application/json

GET /siteserve/status[/:request_id]
Request Parameters
Parameter Type Required? Description
request_id string optional The request_id for which you want to fetch the status. If no request_id is passed, the API will return the current status of the last 25 requests.
Response Body
{
    "request_id":"d65613aa069c45469f0b9e1b5efa1863",
    "created_date":"2015-03-26T04:11:40+05:30",
    "response":{
        "status": "Success",
        "submitted_leads": 10,
        "uploaded_leads": 8,
        "duplicate_leads": 1,
        "invalid_leads": 1,
        "errors": {
                    "Record with EmailAddress='alice@example.com', CampaignID='1234567890111112', PlacementName='placement name' was found duplicate.",
                    "Record with EmailAddress='bob@example', CampaignID='1234567890112', PlacementName='placement name' have invalid emailAddress."
                    "Record with EmailAddress='winston@example.com', CampaignID='1234567890112', PlacementName='placement name' have invalid tactic code."
        }
    }
}
Response Parameters
Parameter Type Description
request_id string The system generated ID for the request which can be later used to get the status of the request. This is particularly useful in case of bulk lead imports.
created_date datetime The timestamp of the request in ISO 8601 format.
status string The current status of the request from the server. If the request was successful, it will return Success and if the request failed, it will return Failed.
submitted_leads integer The number of the leads submitted in the request.
uploaded_leads integer The number of leads successfully imported by the system.
duplicate_leads integer The number of duplicate leads in the request. A duplicate lead is defined as an email address already existing in the system for a particular campaign and placement.
invalid_leads integer The number of invalid leads submitted in the request. An invalid lead is classified as a lead with an invalid email address, incorrect placement/campaign mapping, invalid zip code.
errors array (optional) An array of error messages will ONLY appear if there are any duplicate or invalid leads. It will contain the reason for each of the duplicate and/or invalid leads.


Country Codes

Please find the list of ISO 3166-1 Country Codes below:
Country Name Country CodeCountry Name Country Code
AfghanistanAFAland IslandsAX
AlbaniaALAlgeriaDZ
American SamoaASAndorraAD
AngolaAOAnguillaAI
AntarcticaAQAntigua and BarbudaAG
ArgentinaARArmeniaAM
ArubaAWAustraliaAU
AustriaATAzerbaijanAZ
BahamasBSBahrainBH
BangladeshBDBarbadosBB
BelarusBYBelgiumBE
BelizeBZBeninBJ
BermudaBMBhutanBT
BoliviaBOBosnia and HerzegovinaBA
BotswanaBWBouvet IslandBV
BrazilBRBritish Indian Ocean TerritoryIO
Brunei DarussalamBNBulgariaBG
Burkina FasoBFBurundiBI
CambodiaKHCameroonCM
Cape VerdeCVCaribbean Netherlands BQ
Cayman IslandsKYCentral African RepublicCF
ChadTDChileCL
ChinaCNChristmas IslandCX
Cocos (Keeling) IslandsCCColombiaCO
ComorosKMCongoCG
Congo, Democratic Republic ofCDCook IslandsCK
Costa RicaCRC™te d'IvoireCI
CroatiaHRCubaCU
Cura<8d>aoCWCyprusCY
Czech RepublicCZDenmarkDK
DjiboutiDJDominicaDM
Dominican RepublicDOEcuadorEC
EgyptEGEl SalvadorSV
Equatorial GuineaGQEritreaER
EstoniaEEEthiopiaET
Falkland IslandsFKFaroe IslandsFO
FijiFJFinlandFI
FranceFRFrench GuianaGF
French PolynesiaPFFrench Southern TerritoriesTF
GabonGAGambiaGM
GeorgiaGEGermanyDE
GhanaGHGibraltarGI
GreeceGRGreenlandGL
GrenadaGDGuadeloupeGP
GuamGUGuatemalaGT
GuernseyGGGuineaGN
Guinea-BissauGWGuyanaGY
HaitiHTHeard and McDonald IslandsHM
HondurasHNHong KongHK
HungaryHUIcelandIS
IndiaINIndonesiaID
IranIRIraqIQ
IrelandIEIsle of ManIM
IsraelILItalyIT
JamaicaJMJapanJP
JerseyJEJordanJO
KazakhstanKZKenyaKE
KiribatiKIKuwaitKW
KyrgyzstanKGLao People's Democratic RepublicLA
LatviaLVLebanonLB
LesothoLSLiberiaLR
LibyaLYLiechtensteinLI
LithuaniaLTLuxembourgLU
MacauMOMacedoniaMK
MadagascarMGMalawiMW
MalaysiaMYMaldivesMV
MaliMLMaltaMT
Marshall IslandsMHMartiniqueMQ
MauritaniaMRMauritiusMU
MayotteYTMexicoMX
"Micronesia, Federated States of"FMMoldovaMD
MonacoMCMongoliaMN
MontenegroMEMontserratMS
MoroccoMAMozambiqueMZ
MyanmarMMNamibiaNA
NauruNRNepalNP
New CaledoniaNCNew ZealandNZ
NicaraguaNINigerNE
NigeriaNGNiueNU
Norfolk IslandNFNorth KoreaKP
Northern Mariana IslandsMPNorwayNO
OmanOMPakistanPK
PalauPW"Palestine, State of"PS
PanamaPAPapua New GuineaPG
ParaguayPYPeruPE
PhilippinesPHPitcairnPN
PolandPLPortugalPT
Puerto RicoPRQatarQA
RŽunionRERomaniaRO
Russian FederationRURwandaRW
Saint BarthelemyBLSaint HelenaSH
Saint Kitts and NevisKNSaint LuciaLC
Saint Vincent and the GrenadinesVCSaint-Martin (France)MF
SamoaWSSan MarinoSM
Sao Tome and PrincipeSTSaudi ArabiaSA
SenegalSNSerbiaRS
SeychellesSCSierra LeoneSL
SingaporeSGSint Maarten (Dutch part)SX
SlovakiaSKSloveniaSI
Solomon IslandsSBSomaliaSO
South AfricaZASouth Georgia and the South Sandwich IslandsGS
South KoreaKRSouth SudanSS
SpainESSri LankaLK
St. Pierre and MiquelonPMSudanSD
SurinameSRSvalbard and Jan Mayen IslandsSJ
SwazilandSZSwedenSE
SwitzerlandCHSyriaSY
TaiwanTWTajikistanTJ
TanzaniaTZThailandTH
The NetherlandsNLTimor-LesteTL
TogoTGTokelauTK
TongaTOTrinidad and TobagoTT
TunisiaTNTurkeyTR
TurkmenistanTMTurks and Caicos IslandsTC
TuvaluTVUgandaUG
UkraineUAUnited Arab EmiratesAE
United KingdomGBUnited StatesUS
United States Minor Outlying IslandsUMUruguayUY
UzbekistanUZVanuatuVU
VaticanVAVenezuelaVE
VietnamVNVirgin Islands (British)VG
Virgin Islands (U.S.)VIWallis and Futuna IslandsWF
Western SaharaEHYemenYE
ZambiaZMZimbabweZW

US State Codes

Please find the list of US States and their Codes below:
State Name State CodeState Name State CodeState Name State Code
AlabamaALAlaskaAKArizonaAZ
ArkansasARCaliforniaCAColoradoCO
ConnecticutCTDelawareDEDistrict of ColumbiaDC
FloridaFLGeorgiaGAHawaiiHI
IdahoIDIllinoisILIndianaIN
IowaIAKansasKSKentuckyKY
LouisianaLAMaineMEMontanaMT
NebraskaNENevadaNVNew HampshireNH
New JerseyNJNew MexicoNMNew YorkNY
North CarolinaNCNorth DakotaNDOhioOH
OklahomaOKOregonORMarylandMD
MassachusettsMAMichiganMIMinnesotaMN
MississippiMSMissouriMOPennsylvaniaPA
Rhode IslandRISouth CarolinaSCSouth DakotaSD
TennesseeTNTexasTXUtahUT
VermontVTVirginiaVAWashingtonWA
West VirginiaWVWisconsinWIWyomingWY

Sample Code

Sample code is available in selected languages to help you write integrations faster. Below is a list of all sample codes available in various programming languages:
LanguageFile NameLink
C#SiteServeCSharpSample.zipDownload
JavaSiteServeJavaSample.zipDownload
PHPSiteServePhpSample.zipDownload
PythonSiteServePythonSample.zipDownload