Skip to content

Instantly share code, notes, and snippets.

@JamieHouston
Last active August 15, 2016 16:53
Show Gist options
  • Save JamieHouston/a2502a628f8a5af38076c9546734ab5c to your computer and use it in GitHub Desktop.
Save JamieHouston/a2502a628f8a5af38076c9546734ab5c to your computer and use it in GitHub Desktop.
Salesforce Dreamforce Sessions
using System;
using System.Linq;
using System.Collections.Generic;
using ServiceStack;
using ServiceStack.Text;
class SessionResponse
{
public string Name { get; set; }
}
try
{
var url =
"https://success.salesforce.com/services/apexrest/events?flds=Name,Id,Event_Start_Date__c,Event_End_Date__c,SponsorLevels__c,Label__c,Event_Time_Zone__c,Icon__c,Highlight_Color__c,Event_Type__c,ImageURL_Mobile__c,Venue_City__c,Venue_Country__c,Venue_State__c,Venue__r.Lat_Long__c,Phase__r.SessionsCanBeBooked__c,Phase__r.SessionsIncludeLogisticData__c,Phase__r.SessionsSurveyEnabled__c,Phase__r.MyAgendaVisible__c,Phase__r.SessionsVisible__c,Phase__r.RegistrationAvailable__c,ActiveSponsorCount__c,Pre_Event_Now_Card_Image__c,Post_Event_Now_Card_Image__c,Survey_Ad__c,Session_Record_Type_Info__r.Display_Name__c,Session_Record_Type_Info__r.Session_Record_Type__c,Session_Record_Type_Info__r.Guests_Can_See_Sessions__c";
var response = await url.GetJsonFromUrlAsync();
//response.PrintDump();
var results = response.FromJson<IList<SessionResponse>>();
results.Select(x => x.Name).Join(", ").Print();
//results.PrintDump();
}
catch (Exception ex)
{
"OH NO! Something bad happened: {0}".Print(ex.Message);
}
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="ServiceStack.Text" version="4.0.62" targetFramework="net45" />
<package id="ServiceStack.Client" version="4.0.62" targetFramework="net45" />
<package id="ServiceStack.Interfaces" version="4.0.62" targetFramework="net45" />
</packages>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment