Friday 29 April 2016

WCF RestService over CoreService

WCF RestService over CoreService 

Introduction 

This service is created to get data from SDL Tridion CM Database ,currently this service is tested with SDL Tridion 2013 SP1


In this service you will see many methods are exposed and message format JSON and XML output.

Methods which are available
  1. GetComponentByTcmUri
  2. GetSchemaByTcmUri
  3. GetAllCategoriesWithInPubByTcmUri
  4. GetKeywordByCategoryID
  5. GetPageTempletByPubID
  6. GetComponentTemplateByPubID
  7. GetTemplateBuildingBlockByPubID
  8. GetPageByPubID
  9. GetStructureGroupByPubID
  10. GetMultimediaComponentByPubID
  11. GetPublicationList
  12. GetUserList 


Example
To request a categories from the Tridion CM Database.
http://domainname/RestService.svc/GetAllCategoriesWithInPubByTcmUri/{TCMURI}/{messageformat}
http://domainname/RestService.svc/GetAllCategoriesWithInPubByTcmUri/0-1048-1/JSON

You can download the code from here

Happy coding and keep sharing :)

Thursday 28 April 2016

SDL Tridion 2013 SP1 SmartTarget With Fredhopper on Windows Machine

Fredhopper: SDL Fredhopper is a Customer Experience Management tool which provides a seamless, targeted and fully personalized website experience to the end users. The SDL Fredhopper enables the marketing team to target a specific segment of customer with all the right products or content which suits them best.

SmartTarget: SmartTarget is an add-on for SDL Tridion which integrates SDL Tridion with SDL Fredhopper. SmartTarget acts as a bridge between SDL Tridion and SDL Fredhopper so that Marketers can create, update and manage targeted and personalized content for SDL Tridion driven website.

1      configure fredhopper


 The document is developed for SDL Tridion 2013 SP1, smart target 2014 and fredhopper-7.5-revision-13.You first need to configure fredhopper. Assuming Odata Services and CD is already confirmed.

·         extract fredhopper-7.5-revision-13 in C :

      To download Fredhopper Link you would required valid credentials to login 


·         follow below command to configure the fredhopper

·         You need designated service account with username fredhopper  to configure fredhopper

·         ..\fredhopper\config Create a topology.txt in your Fredhopper config folder
                   # The topology file defines your indexing and live servers
                   # instance name | host | preset | indexer | comment
                      SmartTarget|localhost|1|-|Indexer and Preview environment for demo setup                                           SmartTargetLive|localhost|2|SmartTarget|Live Query Server for demo setup

       Where:
     SmartTarget is the Indexer Server (for getting content into Fredhopper)
                SmartTargetLive is the Query Server (for getting content out of Fredhopper)

1.       Open command prompt cmd /admin and execute the below commands in sequence always in new window.
o    bin\deployment-agent
 
o    bin\setup-cluster

  1. In the ..\fredhopper\data\instances\SmartTarget folder, create a folder \custom.
3.  Copy configuration-management-rest-extension.jar and smarttarget_api_extension.jar to the \custom folder. 
4.  In the  ..\fredhopper\SmartTarget\data\fas-xml-incremental folder, create a folder \catalog01
And Copy the metadata.xml file to the \catalog01 folder. 
5.  Copy the trigger-types.xml and business.xml to C:\fredhopper\data\instances\SmartTarget\config folder. 
6.  Copy the STJob.kjb file to the ..\fredhopper\data\instances\etl folder. 
7.  Start up the SmartTarget or SmartTargetLive instance using the command:
8.  Execute below commands
o    bin\instance SmartTarget start

o    bin\deployment-agent-client –location localhost invoke SmartTarget qserver stop
o    bin\deployment-agent-client –location localhost invoke SmartTarget qserver start

o    bin\run-etl-job STjob.kjb “-DINSTANCE=SmartTarget” “-DTRIGGER=load-data”
 “-DUNIVERSE=catalog01” “-DEXECUTIONPATH=C:/fredhopper/data/instances/SmartTarget/custom”

           9.       Browse to the Fredhopper Business Manager:
     10. http://localhost:8180/fredhopper/admin/ 
   
          11.   Use the credentials admin/admin to log on. (The Business Manager connects to the Indexer Server.)
    
      

      2.Steps for Smart Target static implementation:

Install SmartTarget 2014 available in installation media

Click On Targeting Option







1   .      Create PT for page
1.1.  Add Extract Components from Page tbb.
1.2. Create DWT(Suppose name as ST Region DWT) having content as
<tcdl:region id="Sidebar" type="SmartTarget">

</tcdl:region>

1.3.  Default Finish Actions
1.4.  Open Template Building Block to create PT for page(Suppose name as Smart Target PT)
1.5.  Drag DWT “ST Region DWT” to PT “Smart Target PT”
1.6.  Add SmartTarget Query tbb
1.7.  Add Promotions tbb
1.8.  Add Show SmartTarget Navigation tbb
1.9.  Add Search SmartTarget tbb
1.10.Add Show SmartTarget Items tbb
1.11.Add Apply SmartTarget Settings tbb
1.12. Configure parameter values of above tbbs
1.13.Run PT with page and check if it is working fine

2  .      Create dynamic CT for promotion component
Create a dynamic Component Template (Suppose SendContentToFredhopper) in Template Builder which uses the “Add to SmartTarget” Template Building Block to send content to Fredhopper.
2.1. Add Default DreamWeaver Component Design DWT
2.2.  Add “Add to SmartTarget” tbb
2.3.  Add Default finish action tbb
2.4.  Save and close CT.
2.5.  Add your promotion component schema(Suppose Promotion) as a linked schema

3  .      Create promotion component
Create a component (Suppose “ST Promotion”) with schema “Promotion”.

4  .      Create Promotion
Create a promotion by going to Targeting Tab of CME. Use Trigger as current date.

5  .      Create page
Create a page using PT “Smart Target PT” having component “ST Promotion” and CT “SendContentToFredhopper”.



Execute your Page

Happy Coding and Keep sharing :)

WCF RestService over Broker API

Introduction 

This service is created to get data from SDL Tridion Broker Database using broker API ,currently this service is tested with SDL Tridion 2013 SP1  


In this service you will see many methods are exposed and message format JSON and XML output.

Methods which are available

  1. Get Components by SchemaID
  2. Get Page by URL
  3. Get Page by TcmId 
  4. Get ComponentPresentation By TcmId
  5. Get multipleComponentPresentation By TcmId 
  6. Get ComponentPresentation By PublishedDate
  7. Get ComponentPresentation By SchemaID







Example
To request a page from the Tridion broker.
http://domainname/Tridion2013SP1Provider.svc/GetPagebyUrl/{publicationId}/{format}?url={url} 
http://domainname/Tridion2013SP1Provider.svc/GetPagebyUrl/2073/xml?url=/Collection/index.aspx

You can download the code from here

Happy coding and keep sharing :)

Tuesday 19 April 2016

Install SDL Web 8.1.1 on single machine

Required software for sample single-machine installation

  1. Microsoft Windows Server 2012 R2 (64-bit)
  2. Microsoft SQL Server 2012 SP2
  3. IIS 8.5 (included with Web Server role)
  4. Web Server role, Application Server role
  5. Oracle Java 8, Microsoft .NET Framework 4.5.2
  6. A domain system user for running various low-level services MTSUser

Step 1 .
Install Databases using  Windows PowerShell command line navigate to the the SDL Web installation files Database\MSSQL folder.

**** I have used and run all the power shell command using  Windows PowerShell ISE and run as administrator ****

Install Content Manager database.ps1
Install Topology Manager database.ps1
Install Content Data Store.ps1


Step 2
Access to the SDL web 8.1.1 media and run SDLWeb8CM.exe Provide all the required input and click on next.

Step 3
Ensure that the environment variable JAVA_HOME exists and refers to a compatible Java instance.


Step 4
Setting up Content Delivery for the sample single-machine installation 
create a folder called contentdeployer\ with a subfolder called roles\
From the installation media, copy the following folders with all of their contents, including subfolders, into the contentdeployer\roles\ folder:

  • deployer\
  • discovery\
  • preview\
  • session\
Update
contentdeployer\roles\deployer\standalone\config\cd_deployer_conf.xml
<Property Name="tcdl.target.language" Value="ref" />

contentdeployer\roles\deployer\standalone\config\cd_storage_conf.xml

<Item typeMapping="Page" cached="false" storageId="defaultFile"/>
  1. Open contentdeployer\resources\quickinstall\setenv.ps1 for editing.

Open contentdeployer\resources\quickinstall\setenv.ps1 for editing.and 
update the server name,database name,username,password,DEFAULT_FILE
 path and DEFAULT_DATA_FILE
navigate to contentdeployer\resources\quickinstall and run 
./quickinstall.ps1 -license C:\cd_licences.xml -enable-discovery -enable-deployer -enable-preview -enable-session'

Step 5
Create a Topology Type 
Add-TtmCdTopologyType -Id SampleTopologyType -Name StagingOnlyType -EnvironmentPurposes "Staging"

Content Delivery environment (in one line)
**Here while executing this command I have faced one issue If you want to use OAuth authentication on your Discovery service, you firstly need to register TokenServiceCapability ** StackExchange


Add-TtmCdEnvironment -Id SampleCD -EnvironmentPurpose "Staging" -DiscoveryEndpointUrl http://localhost:8082/discovery.svc 

  -AuthenticationType OAuth -ClientId cmuser -ClientSecret PASSWORD


Create a Topology
Add-TtmCdTopology -Id SampleTopology -Name StagingOnly -CdTopologyTypeId SampleTopologyType -CdEnvironmentIds SampleCD

Define a Web site 
Add-TtmWebsite -Id ApplicaitonName  -CdEnvironmentId SampleCD -BaseUrls http://localhost:82

Step 6
Publication and Testing Application
  1. create a demo publication and create Business Process Types, go to target type tab and select topology type which you have created and save and close
  2. Right click on you demo publication go to general tab and select Business Process Types
  3. Map you publication and webapplication run below command 
    1. Add-TtmMapping -Id ApplicaitonNamewebmapping -PublicationID PUBURI -WebApplicationId ApplicaitonName_RootWebApp
    2. PUBURI  is your publication URL tcm:0-8-1
Step 7
Update your Deployer cd_storage_conf and add

 <Storage Type="filesystem" Class="com.tridion.storage.filesystem.FSDAOFactory" Id="defaultFile"
                     defaultFilesystem="false">
                <Root Path="C:\ApplicaitonName" />
            </Storage>
            <Storage Type="filesystem" Class="com.tridion.storage.filesystem.FSDAOFactory" Id="defaultDataFile"
                     defaultFilesystem="true" defaultStorage="true">
                <Root Path="C:\ApplicaitonName\data" />
  </Storage>
and add item in the ItemTypes
<Item typeMapping="Page" cached="false" storageId="defaultFile"/>

Step 8
Go to your demo publication and create SC and Default page with default page template and publish 

Hit your site URL :)



Happy coding and keep sharing