Developers' Roost

Introduction

Welcome to the CampusRoost developer center. Here you will find the information you need to connect your application to the site. If you want to submit content or customize the community you are in, feel free to contact support.

This documentation is still under development, so feel free to send your inquiries at any time using the contact link above.


Widgets

If you want to invite your users to join CampusRoost easily, you just need to embed one of these widgets in your site. Follow the steps below to customize and invite the students to join CampusRoost:

First, you need to include the following line right before the </head> line in your page's source.

<link rel="stylesheet" type="text/css" href="https://d2y2mrvsotrcc8.cloudfront.net/static/integration/widget.dc3e458f18c3.css" />

Then, add the following script at then end of your page. It's recommended to add it right before the </body> line. Please note the following code requires jQuery.

If you are not using jQuery, then you only need to replace the $(function() { line with the appropiate to fire that function on load.

<script type="text/javascript">
    function showCommunityInvitation() {
        CampusRoost.show_invite({}, {
            first: "Jimmy",
            last: "Smith",
            email: "jsmith@university.edu",
            university_friendly: "Engineerica University",
            university_short: "EU"
        });
    }
    $(function(){
        var s = document.createElement("script"),
            t = document.getElementsByTagName("script")[0];
        s.onload = showCommunityInvitation;
        s.src="https://campusroost.com/connect/widget.js";
        t.parentNode.insertBefore(s, t);
    });
</script>    
    

Example:


Embedding

The easiest way to integrate content displayed in this site is by embedding the content.

To add a page to another site, just add ?embed=yes or ?embed=content-only at the end of the URL. The difference is that by specifying yes you will get the basic navigation and filters in the page. Instead, if you use content-only no navigation is added, unless it's essential to the page's content.

For example, to display the list of questions, you would need to link to the url:
https://campusroost.com/qa/?embed=yes
or:
https://campusroost.com/qa/?embed=content-only

Also, to display the list of updates for your community, you can point to the following link:
https://campusroost.com/news/?embed=content-only

Another option is using an HTML IFRAME to embed the content. For example, you can get this:

Code to create that:

                    <iframe frameborder="0" width="100%" height="300px" src="https://campusroost.com/news/?embed=content-only" style="border: 3px solid #ccc;">
                    </iframe>
                

REST API


Invitation Request

You can request the system to send invitations using the REST API directly. First, you should now if the user already requested information, is registered or opted-out from the system. You can check all those 3 options just by sending an HTTP GET request to the follow service URL:

GET https://campusroost.com/connect/s/request_info/user_hash

For example, if you have an email address, you can use a hashing algorithm such as SHA256 to encrypt the email and send the request, like this:

GET https://campusroost.com/connect/s/request_info/c2d7696087c360b68c5f6ca7f7e9eb1acf0f5a4f32da9c70875ea8580b095077

You will receive a response indicating whether to show the invitation. For example:

{"show_invite": true}

If it returns true to the show_invite property, you can show response. Otherwise you should avoid showing it as the user might have opted-out.

When the user takes action, you can make an HTTP POST to update their preferences. The body of the request must be in JSON format specifying the additional parameters. For example, to request information about the service (out formatted for readability):

POST https://campusroost.com/connect/s/request_info/c2d7696087c360b68c5f6ca7f7e9eb1acf0f5a4f32da9c70875ea8580b095077
                {
                "action": "request_info", 
                "first": "Jimmy", 
                "last": "Smith", 
                "email": "jsmith@university.edu", 
                "university_friendly": "Engineerica University", 
                "university_short": "EU",
                "courses": "MAT-101,ALG-203"
                "source": "Site name"
                }

Note that all that information should be submited only after the user authorized you to send them information about this service.

Also, if the user decides to opt-out, you can update that info as follows:

POST https://campusroost.com/connect/s/request_info/c2d7696087c360b68c5f6ca7f7e9eb1acf0f5a4f32da9c70875ea8580b095077
                {"action": "ignore"}

The following is a list of the available parameters you can send:

Parameter Description Required
action Set to ignore to ignore future requests for this user. Set to request_info to send an email to the user. Yes
email User's email address. If specified, an email will be sent inviting him to join. Yes, only if action=request_info
first User's first name, if requesting information. No
last User's last name, if requesting information. No
university_friendly University name, if requesting information. No
university_short University short name suggestion. If creating a new community and this code matches some internal criterias, it will be used. No
courses Comma separated list of the courses the user is related to (enrolled to or teaches) No
source The source or name of the sender. Eg, AccuTrack. No
source_check Verification value added for verified sources. Details and security token only given upon request from third-party system administrators. No
campaign Text representing the campaign name. No
bulk 'true' to send the request async. Use this if you are going to send several notifications. Not setting this flag might lead to blocking if uploading several users at a time. No
force_send Set to true to send the invitation even if ignored in the past. No

Note: The SHA-256 encryption is not mandatory, we just recommend using some sort of hashing to avoid sending information to the service without the student's authorization. Our system won't use in any way the information unless the user explicitely decides to request more information. So, you can think of it as peace-of-mind measure more than a security measure as the information is secure in any case.

Full API Docs

The general API allows to perform other actions in the system. All the API is restricted for users only and allows them to interact and post new content.

Check the API methods: API Method List