Skip to content

Commit 529269d

Browse files
author
Kelvin Wijaya
authored
Merge pull request #4 from GovTechSG/development
Update documentation
2 parents 513943d + d5cb4e0 commit 529269d

File tree

1 file changed

+24
-24
lines changed

1 file changed

+24
-24
lines changed

README.md

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -74,20 +74,20 @@ The ApiUtilLib Library provide the utility class ApiList to construct request Qu
7474
public static void L1Sample()
7575
{
7676
// application realm
77-
string realm = "http://example.api.com/test";
77+
string realm = "<<your_client_host_url>>";
7878
79-
// authorization prefix
80-
string authPrefix = "auth_l1";
79+
// authorization prefix (i.e 'Apex_l1_eg' )
80+
string authPrefix = "<<authPrefix>>";
8181
8282
// app id and app secret assign to the application
83-
string appId = "app-id-lpX54CVNltS0ye03v2mQc0b";
84-
string appSecret = "5aes9wG4mQgWJBfKMuYLtrEtNslm1enWG2XpGaMk";
83+
string appId = "<<appId>>";
84+
string appSecret = "<<appSecret>>";
8585
86-
// api signing gateway name and path
87-
string gatewayName = "example.api.com";
86+
// api signing Internet gateway name and path (for Intranet i.e <tenant>-pvt.i.api.gov.sg)
87+
string signingGateway = "<tenant>.e.api.gov.sg";
8888
string apiPath = "api/v1/l1/";
8989
90-
// query string
90+
// query string (optional)
9191
var queryParam = new ApiUtilLib.ApiList();
9292
9393
queryParam.Add("clientId", "1256-1231-4598");
@@ -96,9 +96,9 @@ public static void L1Sample()
9696
9797
string queryString = queryParam.ToQueryString();
9898
99-
string baseUrl = string.Format("https://{0}/{1}?{2}", gatewayName, apiPath, queryString);
99+
string baseUrl = string.Format("https://{0}/{1}?{2}", signingGateway, apiPath, queryString);
100100
101-
// form data
101+
// form data (optional)
102102
var formData = new ApiUtilLib.ApiList();
103103
104104
formData.Add("phoneNo", "+1 1234 4567 890");
@@ -110,8 +110,8 @@ public static void L1Sample()
110110
111111
Console.WriteLine("\n>>>Authorization Header :: '{0}'<<<", authorizationHeader);
112112
113-
// if the target gateway name is different from signing gateway name
114-
string targetGatewayName = "example.e.api.com";
113+
// no need append .e on the target Internet gateway name (for Intranet i.e <tenant>-pvt.api.gov.sg)
114+
string targetGatewayName = "<tenant>.api.gov.sg";
115115
string targetBaseUrl = string.Format("https://{0}/{1}?{2}", targetGatewayName, apiPath, queryString);
116116
117117
// this method only for verification only
@@ -125,19 +125,19 @@ public static void L1Sample()
125125
public static void L2Sample()
126126
{
127127
// application realm
128-
string realm = "http://example.api.com/test";
128+
string realm = "<<your_client_host_url>>";
129129
130-
// authorization prefix
131-
string authPrefix = "auth_l2";
130+
// authorization prefix (i.e 'Apex_l2_eg' )
131+
string authPrefix = "<<authPrefix>>";
132132
133-
// app id assign to the application
134-
string appId = "app-id-lpX54CVNltS0ye03v2mQc0b";
133+
// app id i.e 'Apex_l2_eg' assign to the application
134+
string appId = "<<appId>>";
135135
136-
// api signing gateway name and path
137-
string gatewayName = "example.api.com";
136+
// api signing gateway name and path (for Intranet i.e <tenant>-pvt.i.api.gov.sg)
137+
string signingGateway = "<tenant>.e.api.gov.sg";
138138
string apiPath = "api/v1/l2/";
139139
140-
// query string
140+
// query string (optional)
141141
var queryParam = new ApiUtilLib.ApiList();
142142
143143
queryParam.Add("clientId", "1256-1231-4598");
@@ -146,9 +146,9 @@ public static void L2Sample()
146146
147147
string queryString = queryParam.ToQueryString();
148148
149-
string baseUrl = string.Format("https://{0}/{1}?{2}", gatewayName, apiPath, queryString);
149+
string baseUrl = string.Format("https://{0}/{1}?{2}", signingGateway, apiPath, queryString);
150150
151-
// form data
151+
// form data (optional)
152152
var formData = new ApiUtilLib.ApiList();
153153
154154
formData.Add("phoneNo", "+1 1234 4567 890");
@@ -165,8 +165,8 @@ public static void L2Sample()
165165
// authorization header
166166
var authorizationHeader = ApiAuthorization.Token(realm, authPrefix, HttpMethod.POST, new Uri(baseUrl), appId, null, formData, privateKey);
167167
168-
// if the target gateway name is different from signing gateway name
169-
string targetGatewayName = "example.e.api.com";
168+
// no need append .e on the target gateway name (for Intranet i.e <tenant>-pvt.api.gov.sg)
169+
string targetGatewayName = "<tenant>.api.gov.sg";
170170
string targetBaseUrl = string.Format("https://{0}/{1}?{2}", targetGatewayName, apiPath, queryString);
171171
172172
// this method only for verification only

0 commit comments

Comments
 (0)