-
Notifications
You must be signed in to change notification settings - Fork 29
Expand file tree
/
Copy pathpost.js
More file actions
31 lines (29 loc) · 736 Bytes
/
post.js
File metadata and controls
31 lines (29 loc) · 736 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
const request = require('request');
const email = 'johndoe@email.com';
const password = 'secret';
var postData = {
client_id: 123456,
name: 'New Project',
description: 'Project added from API'
};
request.post(
{
url: 'https://app.paymoapp.com/api/projects',
body: JSON.stringify(postData),
headers: {
'Content-type': 'application/json',
'Accept': 'application/json'
},
auth: {
user: email,
pass: password
}
},
function (error, response, body) {
if (!error) {
console.log('New project ID: ' + JSON.parse(body).projects[0].id);
} else {
console.log(error);
}
}
);