0

So basically after looking at the api documentation for c0gnito.cc I tried setting up calling the api and trying to post data, I hope what I did makes enough sense but how would I post this data in Node.js?

"url": "api.c0gnito.cc/generate-keys",
"headers": {
 "privateKey": "privatekey",
 "numberOfLicenses": "1",
 "expiryTime": "24",
 "customMask": "HITLIST-xxxx-xxxx-xxxx"
}

EDIT: I do not understand how I can POST this data, i would appreciate an example, an example to post data as shown above.

2
  • Please post your actual code for making the request, not just the arguments. Also, the request() module is now deprecated and not recommended for new projects. You can see a list of alternatives here. My favorite is got(). Commented Sep 17, 2020 at 22:21
  • @jfriend00 thanks for letting me know but ive edited the description to explain what i was trying to ask better, im trying to ask for an example of how it would be possible to post such data Commented Sep 17, 2020 at 22:35

1 Answer 1

1

Using the got() library (instead of the deprecated request library) and using the headers you show, you could do something like this:

const got = require('got');

got.post("http://api.c0gnito.cc/generate-keys", {
    headers: {
        privateKey: "privatekey",
        numberOfLicenses: "1",
        expiryTime: "24",
        customMask: "HITLIST-xxxx-xxxx-xxxx"
    }
}).then(results => {
    console.log(results);
}).catch(err => {
    console.log(err);
});
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.