I have access to Summer2013 of Versionone. I am trying to access it via new query.v1 using the Json Example which uses a client header cookie that looks like this:
_client.Headers["Cookie"] = ".V1.Ticket.VersionOne.Web=" + ticket;
How do I generate a .V1.Ticket.VersionOne.Web ticket for the cookie?
Json Example: https://github.com/versionone/versionone-oauth2-examples/blob/master/csharp/YamlClient/Program.cs
Note: I have generated a OAuth 2 token via these directions but it doesn't contain a ticket. https://community.versionone.com/Developers/Developer-Library/Documentation/API/Security/Oauth_2.0_Authentication/Using_OAuth_2.0_for_Web_Server_Applications
Here's the code:
namespace V1Json
{
class JsonClient
{
private readonly Uri _url;
private readonly string _ticket;
private WebClient _client;
public JsonClient(string url, string ticket)
{
_url = new Uri(url);
_ticket = ticket;
_client = new WebClient { Encoding = Encoding.UTF8 };
_client.Headers["Cookie"] = ".V1.Ticket.VersionOne.Web=" + ticket;
}
public List<List<dynamic>> GetResultSets(string querybody)
{
var resultbody = _client.UploadString(_url, "SEARCH", querybody);
return JsonConvert.DeserializeObject<List<List<dynamic>>>(resultbody);
}
}
class Program
{
static void Main(string[] args)
{
var url = "https://versionone-test.acme.com/summer13_demo/query.v1";
var authTicket = "AAEAAGvqd3ylmW0FphkxxxHASSMoCrEa...";
var client = new JsonClient(url, authTicket);
I've just updated that example for you, including making it work with the new OAuth2Client code that Joe Koberg created recently.
The new version of the sample includes stored_credentials.json and client_secrets.json files that have already been set up to work against our public test server at http://www14.v1host.com/v1sdktesting. To see the projects there or modify some of the data, use admin / admin to login.
It includes a simple JsonClient which utilizes Newtonsoft to parse the JSON returned from the server.
It's still located at https://github.com/versionone/versionone-oauth2-examples/blob/master/csharp/YamlClient/Program.cs
Using the JsonClient example looks like this: