Repository navigation
Expand file tree
/
Copy pathuspto.js
More file actions
69 lines (62 loc) · 1.64 KB
/
Copy pathuspto.js
File metadata and controls
69 lines (62 loc) · 1.64 KB
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
function expiringPatents(patents) {
//api call to uspto
//search fields applId
const http = require('http');
const postData = JSON.stringify({
'searchText': 'applId:60447158',
'df': 'appFilingDate',
'fq':['appFilingDate:[1988-01-01T00:00:00Z TO 2018-05-20T00:00:00Z]'],
'qf': 'appFilingDate,applId,patentNumber',
'sort': 'appFilingDate asc',
'facet':'false' });
const options = {
hostname: 'ped.uspto.gov',
port: 443,
path: '/api/queries',
method: 'POST',
headers: {
'Content-Type': 'application/json',
}
};
const req = http.request(options, (res) => {
console.log(`STATUS: ${res.statusCode}`);
console.log(`HEADERS: ${JSON.stringify(res.headers)}`);
res.setEncoding('utf8');
res.on('data', (chunk) => {
console.log(`BODY: ${chunk}`);
});
res.on('end', () => {
console.log('No more data in response.');
});
});
req.on('error', (e) => {
console.error(`problem with request: ${e.message}`);
});
console.log('About to post..')
// write data to request body
req.write(postData);
req.end();
}
expiringPatents(1);
/*
var http = require('http')
var request = http.request({
url: 'https://ped.uspto.gov/api/queries',
headers: {
'Content-Type': 'application/json;charset=UTF-8'
},
json: JSON.stringify({
'searchText': 'applId:60447158',
'df': 'appFilingDate',
'fq':['appFilingDate:[1988-01-01T00:00:00Z TO 2018-05-20T00:00:00Z]'],
'qf': 'appFilingDate,applId,patentNumber',
'sort': 'appFilingDate asc',
'facet':'false' })
}, function(response) {
response.setEncoding('utf8');
response.on('data', function(chunk) {
console.log(chunk);
});
});
}
*/