Use REST to use Citrix api call

I’m rewriting out entire php education system. I have to make a call to Citix to register people for a Webinar.

The php I could figure out. To do it in xojo I need to use REST. Not even sure I know what that is.

The Citrix docs are here: https://developer.citrixonline.com/content/gotowebinar-api-reference#/

I only need to use the Create Registrant, sending just the name and email.

Thanks for any help!

You need to read this for start. HTTPSocket
Tip
Get the Paw Paw website
Then this for paw Paw extension

I have no idea where to start with Paw. Apparently the citrix api isn’ t in their collection of api’s.

There docs don’t seem to work on Chrome. I can’t find any tutorial or examples. It’s like learning another language.

Going to see if I can find some more docs elsewhere.

Maybe some of the links on this doc page will help get you started:

Web Services

Is no hard.

  1. Make one app.
  2. Get the Consumer Key
  3. Create oauth_token for access from Consumer key
    Because you ask for Create Registrant this is post command,before you play with post play first with the get command to understand how the api work.(will be more easy for you after).
    Paw from the other side is the app that will help you to understand better the headers,body,access token,etc.
    the last link i have in my previous post is from @Greg O’Lone and you get the xojo code almost ready.

I have php code that works for what it’s worth:

include "citrix.php";

echo "Starting<br>" . 

$citrix = new CitrixAPI();




$organizer_key = '163474974';

$AccessToken = 'ZHy7gJ4rU9timvBesFJdOEX8gkg4';


$citrix = new Citrix('2dd06311c9a59046466f50887bb18c1a1');


if(!$organizer_key)
{
    $url = $citrix->auth_citrixonline();
    echo "<script type='text/javascript'>top.location.href = '$url';</script>";
    exit;
}


$citrix->set_organizer_key($organizer_key);
$citrix->set_access_token($AccessToken);


try
{
	$response = $citrix->citrixonline_create_registrant_of_webinar('116954561299', $data = array('first_name' => 'Testx6First', 'last_name' => 'Testx6Last', 'email'=>'Testx6@email.com')) ;
	$citrix->pr($response);
}catch (Exception $e) {	
	$citrix->pr($e->getMessage());
}

This code relies entirely on the CitrixAPI from the PHP framework they provided, there’s nothing here that will help you in Xojo.

Also, this would fail - syntax error at the beginning.

I got it to work on the Citrix website plugging in the variables. How do I get that into Paw.

curl -X POST --header "Content-Type: application/json" --header "Accept: application/json" --header "Authorization: nuQnPGdRR8emEOSiVdaadsX1K8xQLAjG" -d "{
  \"firstName\": \"First\",
  \"lastName\": \"Last\",
  \"email\": \"1@1.com\",
  \"responses\": [
    {
      \"questionKey\": 0,
      \"responseText\": \"string\",
      \"answerKey\": 0
    }
  ]
}" "https://api.citrixonline.com/G2W/rest/organizers/163724574/webinars/136891331/registrants"

I think I got it, going to put Greg’s plug in in.

[code]// My API

// Set up the socket
// “mySocket” should be a property stored elsewhere so it will not go out of scope
mySocket = new Xojo.Net.HTTPSocket

// Set the URL
dim url as Text = “https://api.citrixonline.com/G2W/rest/organizers/163724574/webinars/136891331/registrants

// Send Synchronous Request
mySocket.Send(“GET”,url)[/code]

and Php cUrl

[code]<?php

// Get cURL resource
$ch = curl_init();

// Set url
curl_setopt($ch, CURLOPT_URL, ‘https://api.citrixonline.com/G2W/rest/organizers/163724574/webinars/136891331/registrants’);

// Set method
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, ‘GET’);

// Set options
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

// Send the request & save response to $resp
$resp = curl_exec($ch);

if(!$resp) {
die(‘Error: "’ . curl_error($ch) . '" - Code: ’ . curl_errno($ch));
} else {
echo "Response HTTP Status Code : " . curl_getinfo($ch, CURLINFO_HTTP_CODE);
echo "
Response HTTP Body : " . $resp;
}

// Close request to clear up some resources
[/code]
Paw have many code generators one of them is php_cUrl

Creating a registrant needs to be a POST request.
But you knew that, because you read the documentation for the API.

@Richard Albrecht
In the link is the webpage for the trial.Citric

those CURL calls should pretty easy translate to our MBS CURL Plugin.
Did you try that way?

@Richard Albrecht
From the notes of api.
To create Registrant you need.
Use the API call “Get registration fields” to get a list of all fields, if they are required, and their possible values. At this time there are two versions of the “Create Registrant” call. The first version only accepts firstName, lastName, and email and ignores all other fields. If you have custom fields or want to capture additional information this version won’t work for you. The second version allows you to pass all required and optional fields, including custom fields defined when creating the webinar. To use the second version you must pass the header value “Accept: application/vnd.citrix.g2wapi-v1.1+json” instead of “Accept: application/json”. Leaving this header out results in the first version of the API call.
So first you need to GET the info from fields about the registrant and after you them to make the POST with them.