Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

76
Views
Anyone have an JavaScript example of the Adfly official API?

The official Adfly API has very poor documentation. So, they say that to make a request you have 2 auth types:

  1. Basic, only 2 parameters.
  2. HMAC that includes some sha256 hashes.

Good, at the moment I follow all the steps but in a moment I cant understand what's going on.

My code:

function computehash(key, update){
  const hash = crypto
  .createHmac(`sha256`, key)
  .update(serialize(update))
  .digest(`base64`);
  console.log(hash)
  return hash
}
async function account(){
  let url = "https://api.adf.ly/v1/account"
  let timestamp = Math.round(new Date().getTime()/1000)
  //let toencode = "_user_id="+userId+"&_api_key="+apiKey+"&_timestamp="+timestamp
      let data = {
    "_user_id": userId,
    "_api_key": apiKey,
    "_timestamp": timestamp//,
    //"_hash": computehash(privateKey, dad)
  }
  dad._hash = computehash(privateKey, data)
  console.log(serialize(data))
  let res = await axios.post(url, serialize(dad), headers)
  console.log(res.data)
}
account();

Here's the API documentation and some examples:

  • Official documentation
  • Official examples
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!