Generates a security token


Before submitting a profile or request data (in any format), the first action required is to generate an authentication token.


The login and password are API specific and do not correspond to any online other platform login.




Parameters



Parameter



Value


action

GENERATETOKEN

login        

{your login details}

password

{your password details}

format


JSON / XML




Success Response





TOKEN:{Token}




JSON





{  
   "TOKEN": "...",

 





SAMPLE NODE.JS NATIVE API REQUEST




var https = require('follow-redirects').https;

var fs = require('fs');


var options = {

  'method': 'GET',

  'hostname': 'peaksprofile.com',

  'path': '/cgi-bin/api.cgi?action=GENERATETOKEN&login=TEST&password=API',

  'headers': {

  },

  'maxRedirects': 20

};


var req = https.request(options, function (res) {

  var chunks = [];


  res.on("data", function (chunk) {

    chunks.push(chunk);

  });


  res.on("end", function (chunk) {

    var body = Buffer.concat(chunks);

    console.log(body.toString());

  });


  res.on("error", function (error) {

    console.error(error);

  });

});


req.end();





SAMPLE PHP (PECL_HTTP) API REQUEST





<?php

$client = new http\Client;

$request = new http\Client\Request;

$request->setRequestUrl('https://peaksprofile.com/cgi-bin/api.cgi?action=GENERATETOKEN&login={LOGIN}&password={PASSWORD}');

$request->setRequestMethod('GET');

$request->setOptions(array());


$client->enqueue($request)->send();

$response = $client->getResponse();

echo $response->getBody();  




Errors


Code


Description


ERROR001

Login details not in the database

ERROR002

Wrong Admin ID associated to the login



Created with the Personal Edition of HelpNDoc: Full-featured EPub generator