Below are the steps to add a node module to an apigee edge free org:
1] Create a node js app and select Hello world sample of node js apiproxy:
2] Once the apiproxy is created , create a package.json file with below contents:
3] Contents of package.json will be :
{
"dependencies" : {
"soap": ""
}
}
The Develop tab in apiproxy will look like below:
As you can see above in the Scripts sections I have only :
==> hello-world.js
==> package.json
4]Once this is done run the management API call to check the node modules and dependencies:
[jagjyot@cmd ~]$ curl -v "https://api.enterprise.apigee.com/v1/organizations/weatherapi/apis/nodesoap/revisions/1/npm" -H "Content-Type: application/x-www-form-urlencoded" -d 'command=ls' -u $password_jagjyot
* Trying 52.70.176.20...
* Connected to api.enterprise.apigee.com (52.70.176.20) port 443 (#0)
* Initializing NSS with certpath: sql:/etc/pki/nssdb
* CAfile: /etc/pki/tls/certs/ca-bundle.crt
CApath: none
* ALPN/NPN, server did not agree to a protocol
* SSL connection using TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
* Server certificate:
* subject: CN=api.enterprise.apigee.com,O=Google Inc,L=Mountain View,ST=California,C=US
* start date: Sep 19 06:31:36 2017 GMT
* expire date: Sep 18 00:00:00 2018 GMT
* common name: api.enterprise.apigee.com
* issuer: CN=Google Internet Authority G2,O=Google Inc,C=US
* Server auth using Basic with user 'jagjyot@google.com'
> POST /v1/organizations/weatherapi/apis/nodesoap/revisions/1/npm HTTP/1.1
> Host: api.enterprise.apigee.com
> Authorization: Basic *************************
> User-Agent: curl/7.47.1
> Accept: */*
> Content-Type: application/x-www-form-urlencoded
> Content-Length: 10
>
* upload completely sent off: 10 out of 10 bytes
< HTTP/1.1 500 Server Error
< Content-Type: text/plain
< Date: Tue, 12 Dec 2017 12:22:01 GMT
< Server: Apigee LB
< Content-Length: 188
< Connection: keep-alive
<
{
"problems": [
"missing: soap@, required by @"
],
"dependencies": {
"soap": {
"required": "",
"missing": true
}
}
}
npm ERR! missing: soap@, required by @
* Connection #0 to host api.enterprise.apigee.com left intact
[jagjyot@cmd ~]$
The above call is run with command=ls. This show the dependencies that need to be installed for this package.json. In this case the dependency is for soap module:
5] Run below call to install dependencies:
[jagjyot@cmd ~]$ curl -v "https://api.enterprise.apigee.com/v1/organizations/weatherapi/apis/nodesoap/revisions/1/npm" -H "Content-Type: application/x-www-form-urlencoded" -d 'command=install' -u $password_jagjyot
* Trying 34.195.71.62...
* Connected to api.enterprise.apigee.com (34.195.71.62) port 443 (#0)
* Initializing NSS with certpath: sql:/etc/pki/nssdb
* CAfile: /etc/pki/tls/certs/ca-bundle.crt
CApath: none
* ALPN/NPN, server did not agree to a protocol
* SSL connection using TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
* Server certificate:
* subject: CN=api.enterprise.apigee.com,O=Google Inc,L=Mountain View,ST=California,C=US
* start date: Sep 19 06:31:36 2017 GMT
* expire date: Sep 18 00:00:00 2018 GMT
* common name: api.enterprise.apigee.com
* issuer: CN=Google Internet Authority G2,O=Google Inc,C=US
* Server auth using Basic with user 'jagjyot@google.com'
> POST /v1/organizations/weatherapi/apis/nodesoap/revisions/1/npm HTTP/1.1
> Host: api.enterprise.apigee.com
> Authorization: Basic ***********************
> User-Agent: curl/7.47.1
> Accept: */*
> Content-Type: application/x-www-form-urlencoded
> Content-Length: 15
>
* upload completely sent off: 15 out of 15 bytes
^@< HTTP/1.1 200 OK
< Access-Control-Allow-Headers: origin, x-requested-with, accept
< Access-Control-Allow-Methods: GET, PUT, POST, DELETE
< Access-Control-Allow-Origin: *
< Access-Control-Max-Age: 3628800
< Content-Type: application/json
< Date: Tue, 12 Dec 2017 12:22:47 GMT
< Server: Apigee LB
< Content-Length: 16452
< Connection: keep-alive
<
[
{
"name": "soap",
"version": "0.23.0",
"from": "soap@*",
"dependencies": {
"selectn": {
"version": "0.9.6",
"from": "selectn@>=0.9.6 <0.10.0",
"dependencies": {}
},
"sax": {
"version": "1.2.4",
"from": "sax@>=0.6.0",
"dependencies": {}
},
"uuid": {
"version": "3.1.0",
"from": "uuid@>=3.1.0 <4.0.0",
"dependencies": {}
},
"ejs": {
"version": "2.5.7",
"from": "ejs@>=2.5.5 <2.6.0",
"dependencies": {}
},
"debug": {
"version": "2.6.9",
"from": "debug@>=2.6.9 <3.0.0",
"dependencies": {
"ms": {
"version": "2.0.0",
"from": "ms@2.0.0",
"dependencies": {}
}
}
},
"strip-bom": {
"version": "0.3.1",
"from": "strip-bom@>=0.3.1 <0.4.0",
"dependencies": {
"first-chunk-stream": {
"version": "0.1.0",
"from": "first-chunk-stream@>=0.1.0 <0.2.0",
"dependencies": {}
},
"is-utf8": {
"version": "0.2.1",
"from": "is-utf8@>=0.2.0 <0.3.0",
"dependencies": {}
}
}
},
"finalhandler": {
"version": "1.1.0",
"from": "finalhandler@>=1.0.3 <2.0.0",
"dependencies": {
"escape-html": {
"version": "1.0.3",
"from": "escape-html@>=1.0.3 <1.1.0",
"dependencies": {}
},
"unpipe": {
"version": "1.0.0",
"from": "unpipe@>=1.0.0 <1.1.0",
"dependencies": {}
},
"encodeurl": {
"version": "1.0.1",
"from": "encodeurl@>=1.0.1 <1.1.0",
"dependencies": {}
},
"parseurl": {
"version": "1.3.2",
"from": "parseurl@>=1.3.2 <1.4.0",
"dependencies": {}
},
"statuses": {
"version": "1.3.1",
"from": "statuses@>=1.3.1 <1.4.0",
"dependencies": {}
},
"on-finished": {
"version": "2.3.0",
"from": "on-finished@>=2.3.0 <2.4.0",
"dependencies": {
"ee-first": {
"version": "1.1.1",
"from": "ee-first@1.1.1",
"dependencies": {}
}
}
}
}
},
"bluebird": {
"version": "3.5.1",
"from": "bluebird@>=3.5.0 <4.0.0",
"dependencies": {}
},
"xml-crypto": {
"version": "0.8.5",
"from": "xml-crypto@>=0.8.0 <0.9.0",
"dependencies": {
"xmldom": {
"version": "0.1.19",
"from": "xmldom@0.1.19",
"dependencies": {}
},
"xpath.js": {
"version": "1.0.7",
"from": "xpath.js@>=0.0.3",
"dependencies": {}
}
}
},
"concat-stream": {
"version": "1.6.0",
"from": "concat-stream@>=1.5.1 <2.0.0",
"dependencies": {
"inherits": {
"version": "2.0.3",
"from": "inherits@>=2.0.3 <3.0.0",
"dependencies": {}
},
"typedarray": {
"version": "0.0.6",
"from": "typedarray@>=0.0.6 <0.0.7",
"dependencies": {}
},
"readable-stream": {
"version": "2.3.3",
"from": "readable-stream@>=2.2.2 <3.0.0",
"dependencies": {
"process-nextick-args": {
"version": "1.0.7",
"from": "process-nextick-args@>=1.0.6 <1.1.0",
"dependencies": {}
},
"util-deprecate": {
"version": "1.0.2",
"from": "util-deprecate@>=1.0.1 <1.1.0",
"dependencies": {}
},
"string_decoder": {
"version": "1.0.3",
"from": "string_decoder@>=1.0.3 <1.1.0",
"dependencies": {}
},
"isarray": {
"version": "1.0.0",
"from": "isarray@>=1.0.0 <1.1.0",
"dependencies": {}
},
"core-util-is": {
"version": "1.0.2",
"from": "core-util-is@>=1.0.0 <1.1.0",
"dependencies": {}
},
"safe-buffer": {
"version": "5.1.1",
"from": "safe-buffer@>=5.1.1 <6.0.0",
"dependencies": {}
}
}
}
}
},
"serve-static": {
"version": "1.13.1",
"from": "serve-static@>=1.11.1 <2.0.0",
"dependencies": {
"escape-html": {
"version": "1.0.3",
"from": "escape-html@>=1.0.3 <1.1.0",
"dependencies": {}
},
"encodeurl": {
"version": "1.0.1",
"from": "encodeurl@>=1.0.1 <1.1.0",
"dependencies": {}
},
"parseurl": {
"version": "1.3.2",
"from": "parseurl@>=1.3.2 <1.4.0",
"dependencies": {}
},
"send": {
"version": "0.16.1",
"from": "send@0.16.1",
"dependencies": {
"destroy": {
"version": "1.0.4",
"from": "destroy@>=1.0.4 <1.1.0",
"dependencies": {}
},
"ms": {
"version": "2.0.0",
"from": "ms@2.0.0",
"dependencies": {}
},
"range-parser": {
"version": "1.2.0",
"from": "range-parser@>=1.2.0 <1.3.0",
"dependencies": {}
},
"fresh": {
"version": "0.5.2",
"from": "fresh@0.5.2",
"dependencies": {}
},
"etag": {
"version": "1.8.1",
"from": "etag@>=1.8.1 <1.9.0",
"dependencies": {}
},
"statuses": {
"version": "1.3.1",
"from": "statuses@>=1.3.1 <1.4.0",
"dependencies": {}
},
"depd": {
"version": "1.1.1",
"from": "depd@>=1.1.1 <1.2.0",
"dependencies": {}
},
"mime": {
"version": "1.4.1",
"from": "mime@1.4.1",
"dependencies": {}
},
"on-finished": {
"version": "2.3.0",
"from": "on-finished@>=2.3.0 <2.4.0",
"dependencies": {
"ee-first": {
"version": "1.1.1",
"from": "ee-first@1.1.1",
"dependencies": {}
}
}
},
"http-errors": {
"version": "1.6.2",
"from": "http-errors@>=1.6.2 <1.7.0",
"dependencies": {
"setprototypeof": {
"version": "1.0.3",
"from": "setprototypeof@1.0.3",
"dependencies": {}
},
"inherits": {
"version": "2.0.3",
"from": "inherits@2.0.3",
"dependencies": {}
}
}
}
}
}
}
},
"lodash": {
"version": "3.10.1",
"from": "lodash@>=3.10.1 <4.0.0",
"dependencies": {}
},
"request": {
"version": "2.83.0",
"from": "request@>=2.9.0",
"dependencies": {
"is-typedarray": {
"version": "1.0.0",
"from": "is-typedarray@>=1.0.0 <1.1.0",
"dependencies": {}
},
"oauth-sign": {
"version": "0.8.2",
"from": "oauth-sign@>=0.8.2 <0.9.0",
"dependencies": {}
},
"forever-agent": {
"version": "0.6.1",
"from": "forever-agent@>=0.6.1 <0.7.0",
"dependencies": {}
},
"stringstream": {
"version": "0.0.5",
"from": "stringstream@>=0.0.5 <0.1.0",
"dependencies": {}
},
"aws-sign2": {
"version": "0.7.0",
"from": "aws-sign2@>=0.7.0 <0.8.0",
"dependencies": {}
},
"tunnel-agent": {
"version": "0.6.0",
"from": "tunnel-agent@>=0.6.0 <0.7.0",
"dependencies": {}
},
"caseless": {
"version": "0.12.0",
"from": "caseless@>=0.12.0 <0.13.0",
"dependencies": {}
},
"isstream": {
"version": "0.1.2",
"from": "isstream@>=0.1.2 <0.2.0",
"dependencies": {}
},
"json-stringify-safe": {
"version": "5.0.1",
"from": "json-stringify-safe@>=5.0.1 <5.1.0",
"dependencies": {}
},
"safe-buffer": {
"version": "5.1.1",
"from": "safe-buffer@>=5.1.1 <6.0.0",
"dependencies": {}
},
"extend": {
"version": "3.0.1",
"from": "extend@>=3.0.1 <3.1.0",
"dependencies": {}
},
"aws4": {
"version": "1.6.0",
"from": "aws4@>=1.6.0 <2.0.0",
"dependencies": {}
},
"performance-now": {
"version": "2.1.0",
"from": "performance-now@>=2.1.0 <3.0.0",
"dependencies": {}
},
"qs": {
"version": "6.5.1",
"from": "qs@>=6.5.1 <6.6.0",
"dependencies": {}
},
"combined-stream": {
"version": "1.0.5",
"from": "combined-stream@>=1.0.5 <1.1.0",
"dependencies": {
"delayed-stream": {
"version": "1.0.0",
"from": "delayed-stream@>=1.0.0 <1.1.0",
"dependencies": {}
}
}
},
"form-data": {
"version": "2.3.1",
"from": "form-data@>=2.3.1 <2.4.0",
"dependencies": {
"asynckit": {
"version": "0.4.0",
"from": "asynckit@>=0.4.0 <0.5.0",
"dependencies": {}
}
}
},
"tough-cookie": {
"version": "2.3.3",
"from": "tough-cookie@>=2.3.3 <2.4.0",
"dependencies": {
"punycode": {
"version": "1.4.1",
"from": "punycode@>=1.4.1 <2.0.0",
"dependencies": {}
}
}
},
"mime-types": {
"version": "2.1.17",
"from": "mime-types@>=2.1.17 <2.2.0",
"dependencies": {
"mime-db": {
"version": "1.30.0",
"from": "mime-db@>=1.30.0 <1.31.0",
"dependencies": {}
}
}
},
"hawk": {
"version": "6.0.2",
"from": "hawk@>=6.0.2 <6.1.0",
"dependencies": {
"sntp": {
"version": "2.1.0",
"from": "sntp@>=2.0.0 <3.0.0",
"dependencies": {}
},
"boom": {
"version": "4.3.1",
"from": "boom@>=4.0.0 <5.0.0",
"dependencies": {}
},
"hoek": {
"version": "4.2.0",
"from": "hoek@>=4.0.0 <5.0.0",
"dependencies": {}
},
"cryptiles": {
"version": "3.1.2",
"from": "cryptiles@>=3.0.0 <4.0.0",
"dependencies": {
"boom": {
"version": "5.2.0",
"from": "boom@>=5.0.0 <6.0.0",
"dependencies": {}
}
}
}
}
},
"http-signature": {
"version": "1.2.0",
"from": "http-signature@>=1.2.0 <1.3.0",
"dependencies": {
"assert-plus": {
"version": "1.0.0",
"from": "assert-plus@>=1.0.0 <2.0.0",
"dependencies": {}
},
"jsprim": {
"version": "1.4.1",
"from": "jsprim@>=1.2.2 <2.0.0",
"dependencies": {
"extsprintf": {
"version": "1.3.0",
"from": "extsprintf@1.3.0",
"dependencies": {}
},
"verror": {
"version": "1.10.0",
"from": "verror@1.10.0",
"dependencies": {
"core-util-is": {
"version": "1.0.2",
"from": "core-util-is@1.0.2",
"dependencies": {}
}
}
},
"json-schema": {
"version": "0.2.3",
"from": "json-schema@0.2.3",
"dependencies": {}
}
}
},
"sshpk": {
"version": "1.13.1",
"from": "sshpk@>=1.7.0 <2.0.0",
"dependencies": {
"getpass": {
"version": "0.1.7",
"from": "getpass@>=0.1.1 <0.2.0",
"dependencies": {}
},
"bcrypt-pbkdf": {
"version": "1.0.1",
"from": "bcrypt-pbkdf@>=1.0.0 <2.0.0",
"dependencies": {}
},
"ecc-jsbn": {
"version": "0.1.1",
"from": "ecc-jsbn@>=0.1.1 <0.2.0",
"dependencies": {}
},
"jsbn": {
"version": "0.1.1",
"from": "jsbn@>=0.1.0 <0.2.0",
"dependencies": {}
},
"asn1": {
"version": "0.2.3",
"from": "asn1@>=0.2.3 <0.3.0",
"dependencies": {}
},
"dashdash": {
"version": "1.14.1",
"from": "dashdash@>=1.12.0 <2.0.0",
"dependencies": {}
},
"tweetnacl": {
"version": "0.14.5",
"from": "tweetnacl@>=0.14.0 <0.15.0",
"dependencies": {}
}
}
}
}
},
"har-validator": {
"version": "5.0.3",
"from": "har-validator@>=5.0.3 <5.1.0",
"dependencies": {
"har-schema": {
"version": "2.0.0",
"from": "har-schema@>=2.0.0 <3.0.0",
"dependencies": {}
},
"ajv": {
"version": "5.5.1",
"from": "ajv@>=5.1.0 <6.0.0",
"dependencies": {
"co": {
"version": "4.6.0",
"from": "co@>=4.6.0 <5.0.0",
"dependencies": {}
},
"json-schema-traverse": {
"version": "0.3.1",
"from": "json-schema-traverse@>=0.3.0 <0.4.0",
"dependencies": {}
},
"fast-deep-equal": {
"version": "1.0.0",
"from": "fast-deep-equal@>=1.0.0 <2.0.0",
"dependencies": {}
},
"fast-json-stable-stringify": {
"version": "2.0.0",
"from": "fast-json-stable-stringify@>=2.0.0 <3.0.0",
"dependencies": {}
}
}
}
}
}
}
}
}
}
]
* Connection #0 to host api.enterprise.apigee.com left intact
[jagjyot@cmd ~]$
6] Above command will install all the dependencies now the Develop tab in the apiproxy will look like below:
7] In step 3 we saw two files now we do see the soap module installed as well:
As you can see above in the Scripts sections I have only :
==> hello-world.js
==> node_modules_soap.zip
==> package.json
This completes the installation of soap module for node js on a free org.
The above steps does not require an enterprise account. This is done on a free org “weatherapi”
Regards,
Jagjyot