Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

agility-ugc

Package Overview
Dependencies
Maintainers
3
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

agility-ugc

JavaScript Library sdk to facilitate client-side interaction with Agility UGC.

latest
Source
npmnpm
Version
1.2.0
Version published
Weekly downloads
32
18.52%
Maintainers
3
Weekly downloads
 
Created
Source

Agility User Generated Content API - JS SDK

JavaScript Library to facilitate client-side interaction with Agility UGC API. Currently, this only supports being used in the browser.

Installation

npm install agility-ugc

Initialize Client

You must intialize the client with several values specific to you, you will then hash it and pass the values to the UGC SDK. The SDK will automatically look for this variable in your global namespace. The AccessHash should be computed server-side in order to protect your SecretKey.

You need an Access Key and Secret Key in order to generate your access hash. Contact support@agilitycms.com if do you do not have one.

//set a global window variable with the following values:
var _AgilityUGCSettings = { 
    'Url': 'https://ugc.agilitycms.com/Agility-UGC-API-JSONP.svc',
    'AccessKey': '553901D2-F5E1-4BBA-B346-159xxxxxxx', //the website API Access Key provided to you
    'Seconds': '567353588', //is the number of seconds that have elapsed since Jan 1/2001.
    'RandomNumber': '205', //just a random number between 1-1000
    'ProfileRecordID': '-1', //the profile record ID of the logged-in website user, -1 is anonymous
    'AccessHash': '7c690bdac92defff3a676e24ded04c5xxxxxxx' //The SHA hash of all the above variables
                                                           //(Seconds.ProfileID.SecretKey.AccessKey.Random)
};

See Generating a UGC Access Hash in .NET Core for a code sample on how to generate your hash and initialize your client.

Usage

import ugcClient from 'agility-ugc'

ugcClient.GetRecord(1027, function(data) {	
    if (data.ResponseType != ugcClient.ResponseType.OK) {
        //error occurred
        alert("An error occurred: " + data.Message);			
    } else {
        //data.ResponseData is a "Record" object
        var record = data.ResponseData;
        console.log(record);
    }
})

Documentation

Keywords

Agility

FAQs

Package last updated on 15 Sep 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts