-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample.js
More file actions
85 lines (76 loc) · 2.18 KB
/
example.js
File metadata and controls
85 lines (76 loc) · 2.18 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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
const axios = require('axios')
// The primary key in the data the composite of appId + eosAccount. This allows multiple apps to use
// the service and have different contact info and preferences for the same account.
// Register a new account
axios({
method: 'POST',
headers: { 'Content-Type': 'application/json', 'x-api-key': 'r6hj3RIR7p3q23WP9wEUZ6wGfxwnL5Oh7incSQJ8' },
url: 'https://profiles-api.disc.blue/dev/register',
data: {
appId: "myApp",
eosAccount: "samplesample",
smsNumber: "+18017349653",
commPref: "SMS"
}
})
.then((response) => {
console.log(response.data)
})
.catch((error) => {
console.error(error)
});
// You can later add email address to the same eosAccount
axios({
method: 'POST',
headers: { 'Content-Type': 'application/json', 'x-api-key': 'r6hj3RIR7p3q23WP9wEUZ6wGfxwnL5Oh7incSQJ8' },
url: 'https://profiles-api.disc.blue/dev/register',
data: {
appId: "myApp",
eosAccount: "samplesample",
emailAddress: "sample@sample.com"
}
})
.then((response) => {
console.log(response.data)
})
.catch((error) => {
console.log(error)
});
// You can send messages to the eosAccount
axios({
method: 'POST',
headers: { 'Content-Type': 'application/json', 'x-api-key': 'r6hj3RIR7p3q23WP9wEUZ6wGfxwnL5Oh7incSQJ8' },
url: 'https://profiles-api.disc.blue/dev/send-msg',
data: {
appId: "myApp",
eosAccount: "samplesample",
message: "Your order has been accepted. Please transfer funds."
}
})
.then((response) => {
console.log(response.data)
})
.catch((error) => {
console.log(error)
});
// Apps can also custom attributes for their app to each profile; this could be used for
// data or configuration that the user would not want stored on chain
axios({
method: 'POST',
headers: { 'Content-Type': 'application/json', 'x-api-key': 'r6hj3RIR7p3q23WP9wEUZ6wGfxwnL5Oh7incSQJ8' },
url: 'https://profiles-api.disc.blue/dev/register',
data: {
appId: "myApp",
eosAccount: "samplesample",
appAttributes: {
"dob": "23 May 1998",
"country": "Nepal"
}
}
})
.then((response) => {
console.log(response.data)
})
.catch((error) => {
console.log(error)
});