diff --git a/README.md b/README.md
index fd9bc62d..d9ebb1ba 100644
--- a/README.md
+++ b/README.md
@@ -700,6 +700,19 @@ The following parameters are required. See Common Reference for a list of additi
A sample file format can be found [here](https://github.com/srinandan/apigeecli/blob/master/test/products_config.json)
+### export
+
+Export API products to a file
+
+```
+apigeecli prods export -o org -c connections
+```
+Required parameters
+The following parameters are required. See Common Reference for a list of additional parameters.
+
+`--org -o` (required) Apigee organization name
+`--conn -c` (optional) Number of connections to establish; default is 4
+
---
## sharedflows
diff --git a/cmd/shared/shared_test.go b/cmd/shared/shared_test.go
index 15925ed3..89b9763e 100644
--- a/cmd/shared/shared_test.go
+++ b/cmd/shared/shared_test.go
@@ -42,3 +42,12 @@ func TestDownloadResource(t *testing.T) {
t.Fatal(err)
}
}
+
+func TestWriteJSONArrayToFile(t *testing.T) {
+ Init()
+ var entityPayloadList = [][]byte{{'g', 'o'}, {'l', 'a', 'n', 'g'}}
+ err := WriteJSONArrayToFile("test.json", entityPayloadList)
+ if err != nil {
+ t.Fatal(err)
+ }
+}
diff --git a/main_test.go b/main_test.go
index bdb99fa9..546a6f7b 100644
--- a/main_test.go
+++ b/main_test.go
@@ -105,7 +105,6 @@ func TestListExpandDeveloper(t *testing.T) {
// kvm test
func TestCreateKVM(t *testing.T) {
- name := "test"
cmd := exec.Command(apigeecli, "kvms", "create", "-o", org, "-e", env, "-n", name, "-t", token, "-l")
err := cmd.Run()
@@ -261,6 +260,15 @@ func TestDeleteTS(t *testing.T) {
}
+func TestExportProducts(t *testing.T) {
+
+ cmd := exec.Command(apigeecli, "products", "export", "-o", org, "-t", token, "-l")
+ err := cmd.Run()
+ if err != nil {
+ t.Fatal(err)
+ }
+}
+
//get requires an app id. run list and get an app id or get it from create
/*func TestGetApp(t *testing.T) {
cmd := exec.Command(apigeecli, "apps", "get", "-o", org, "-i", appID, "-t", token, "-l")
diff --git a/products.json b/products.json
deleted file mode 100644
index f6e9f675..00000000
--- a/products.json
+++ /dev/null
@@ -1,85 +0,0 @@
-[{
- "name": "inventory_product",
- "displayName": "Inventory Product",
- "approvalType": "auto",
- "attributes": [
- {
- "name": "access",
- "value": "public"
- }
- ],
- "environments": [
- "test"
- ],
- "proxies": [
- "inventory-app"
- ],
- "createdAt": "1560474156482",
- "lastModifiedAt": "1560474156482"
-}
-,{
- "name": "sample_product",
- "displayName": "Sample Product",
- "approvalType": "auto",
- "attributes": [
- {
- "name": "access",
- "value": "public"
- }
- ],
- "apiResources": [
- "/",
- "/**"
- ],
- "environments": [
- "test"
- ],
- "proxies": [
- "edgemicro-auth",
- "helloworld"
- ],
- "createdAt": "1560185702014",
- "lastModifiedAt": "1560535818257"
-}
-,{
- "name": "cassandra product",
- "displayName": "cassandra product",
- "approvalType": "auto",
- "attributes": [
- {
- "name": "access",
- "value": "public"
- }
- ],
- "apiResources": [
- "/"
- ],
- "environments": [
- "test"
- ],
- "proxies": [
- "cassandra-proxy"
- ],
- "createdAt": "1562710336931",
- "lastModifiedAt": "1562710336931"
-}
-,{
- "name": "websockets_product",
- "displayName": "Websockets Product",
- "approvalType": "auto",
- "attributes": [
- {
- "name": "access",
- "value": "public"
- }
- ],
- "environments": [
- "test"
- ],
- "proxies": [
- "websockets"
- ],
- "createdAt": "1560530447410",
- "lastModifiedAt": "1560530447410"
-}
-]
\ No newline at end of file