-
Notifications
You must be signed in to change notification settings - Fork 0
/
_sampleRestAPICalls.html
83 lines (72 loc) · 1.81 KB
/
_sampleRestAPICalls.html
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
<script runat="server">
Platform.Load("core", "1.1.1");
var _api = Platform.Function.ContentBlockByID('####')
var api = _api();
var apiConfig = {
authBase: "https://{{ SUBDOMAIN }}.auth.marketingcloudapis.com/",
mid: "{{ MID }}",
clientID: "{{ CLIENT_ID }}",
clientSecret: "{{ CLIENT_SECRET }}"
}
// add accessToken and restBase to apiConfig object
var authObject = api.auth(apiConfig);
apiConfig.accessToken = authObject.accessToken;
apiConfig.restBase = authObject.restBase;
/**
Start Simple GET Request
*/
var getContentBuilderAssetConfig = {
url: "asset/v1/content/assets/",
method: "GET"
}
var contentBuilderAssets = api.scriptUtil(getContentBuilderAssetConfig, apiConfig)
Write(Stringify(contentBuilderAssets))
/**
End Simple GET Request
*/
/**
Start Simple Post Request
*/
var contentBuilderAssetsQueryConfig = {
url: "asset/v1/content/assets/query",
method: "POST",
payload: {
"page": {
"page": 1,
"pageSize": 50
},
"query": {
"leftOperand": {
"property": "createdDate",
"simpleOperator": "greaterThan",
"value": "2019-07-18T13:35:27.327-06:00"
},
"logicalOperator": "AND",
"rightOperand": {
"property": "assetType.name",
"simpleOperator": "equal",
"value": "png"
}
},
"sort": [
{
"property": "id",
"direction": "ASC"
}
],
"fields": [
"enterpriseId",
"memberId",
"thumbnail",
"category",
"content",
"data"
]
}
}
var contentBuilderAssetsQuery = api.scriptUtil(contentBuilderAssetsQueryConfig, apiConfig)
Write(Stringify(contentBuilderAssetsQuery))
/**
End Simple GET Request
*/
</script>