@@ -33,15 +33,15 @@ var apigClient = apigClientFactory.newClient(config);
3333Calls to an API take the form outlined below. Each API call returns a promise, that invokes either a success and failure callback
3434
3535```
36- var params = {
37- //This is where any header, path, or querystring request params go. The key is the parameter named as defined in the API
36+ var pathParams = {
37+ //This is where path request params go.
3838 userId: '1234',
3939};
4040// Template syntax follows url-template https://www.npmjs.com/package/url-template
4141var pathTemplate = '/users/{userID}/profile'
4242var method = 'GET';
4343var additionalParams = {
44- //If there are any unmodeled query parameters or headers that need to be sent with the request you can add them here
44+ //If there are query parameters or headers that need to be sent with the request you can add them here
4545 headers: {
4646 param0: '',
4747 param1: ''
@@ -55,7 +55,7 @@ var body = {
5555 //This is where you define the body of the request
5656};
5757
58- apigClient.invokeApi(params , pathTemplate, method, additionalParams, body)
58+ apigClient.invokeApi(pathParams , pathTemplate, method, additionalParams, body)
5959 .then(function(result){
6060 //This is where you would put a success callback
6161 }).catch( function(result){
@@ -68,11 +68,11 @@ To initialize the SDK with AWS Credentials use the code below. Note, if you use
6868
6969```
7070var apigClient = apigClientFactory.newClient({
71- invokeUrl:'https://xxxxx.execute-api.us-east-1.amazonaws.com',
72- accessKey: 'ACCESS_KEY',
73- secretKey: 'SECRET_KEY',
71+ invokeUrl:'https://xxxxx.execute-api.us-east-1.amazonaws.com', // REQUIRED
72+ accessKey: 'ACCESS_KEY', // REQUIRED
73+ secretKey: 'SECRET_KEY', // REQUIRED
7474 sessionToken: 'SESSION_TOKEN', //OPTIONAL: If you are using temporary credentials you must include the session token
75- region: 'eu-west-1', // OPTIONAL : The region where the API is deployed, by default this parameter is set to us-east-1
75+ region: 'eu-west-1', // REQUIRED : The region where the API is deployed.
7676 systemClockOffset: 0, // OPTIONAL: An offset value in milliseconds to apply to signing time
7777 retries: 4, // OPTIONAL: Number of times to retry before failing. Uses axon-retry plugin.
7878 retryCondition: (err) => { // OPTIONAL: Callback to further control if request should be retried. Uses axon-retry plugin.
@@ -86,19 +86,8 @@ To use an API Key with the client SDK you can pass the key as a parameter to the
8686
8787```
8888var apigClient = apigClientFactory.newClient({
89- apiKey: 'API_KEY'
89+ invokeUrl:'https://xxxxx.execute-api.us-east-1.amazonaws.com', // REQUIRED
90+ apiKey: 'API_KEY', // REQUIRED
91+ region: 'eu-west-1' // REQUIRED
9092});
9193```
92-
93- # Troubleshooting
94- The standard Javascript SDK as generated by AWS API Gateway hard codes assertions for your query parameters and headers, which is not possible in this module. Therefore, the params object passed to your ` apigClient.invokeApi() ` must contain keys that conform exactly to your API definitions.
95-
96- ```
97- http://example.com/prod?userId=123&info=hello&state=NY
98-
99- var params = {
100- userId: '123',
101- info: 'hello',
102- state: 'NY'
103- }
104- ```
0 commit comments