Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var credentials = {
- username: 'bunnyman',
- password: '*******'
- };
- // Stuff the cookie into a global (for now)
- var cookie;
- request.post({
- uri: the_uri_of_the_login_api,
- headers: { 'content-type': 'application/json' },
- json: credentials
- }, function(err, res, body){
- if(err) {
- console.log("error", body);
- } else {
- cookie = body;
- }
- });
- var query = {
- "input": { "some_form_property": "value" },
- "additionalInput": {
- "8d817939-your-api-key-f5dc9502ed72": cookie
- },
- "returnPaginationSuggestions": true
- }
- request.post({
- uri: the_uri_of_the_query_api,
- headers: { 'content-type': 'application/json' },
- json: query
- }, function (error, response, payload){
- if (error){
- console.log(payload);
- } else {
- console.log(payload);
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement