contentful-cli icon indicating copy to clipboard operation
contentful-cli copied to clipboard

Cannot export specified content type with CLI Export

Open empatel96 opened this issue 2 years ago • 3 comments

Expected Behavior

After running the export query on the CLI, only the Content Types specified in the field queryEntries in the config file should be fetched.

Actual Behavior

Follow up on #1468.

user@MacBook-Pro ~ % contentful space export --config "cli-config.json"

  ✔ Initialize client (1s)
  ✔ Fetching data from space
    ✔ Connecting to space (1s)
    ✔ Fetching content types data (2s)
    ✔ Fetching tags data (1s)
    ✔ Fetching editor interfaces data (4s)
    ✔ Fetching content entries data (2s)
    ✔ Fetching assets data (1s)
    ✔ Fetching locales data (1s)
    ↓ Fetching webhooks data [skipped]
      → Webhooks can only be exported from master environment
    ↓ Fetching roles data [skipped]
      → Roles can only be exported from master environment
  ↓ Download assets [skipped]
  ✔ Write export log file
    ✔ Lookup directory to store the logs
    ✔ Create log directory
    ✔ Writing data to file
┌─────────────────────────┐
│ Exported entities       │
├───────────────────┬─────┤
│ Content Types     │ 11  │
├───────────────────┼─────┤
│ Tags              │ 7   │
├───────────────────┼─────┤
│ Editor Interfaces │ 11  │
├───────────────────┼─────┤
│ Entries           │ 374 │
├───────────────────┼─────┤
│ Assets            │ 226 │
├───────────────────┼─────┤
│ Locales           │ 3   │
└───────────────────┴─────┘

Steps to Reproduce

I find myself having the same issue. It downloads all content types instead of just 'convertTest' type

  "spaceId": "space-id",
  "environmentId": "environment",
  "managementToken": "CFPAT-token",
  "exportDir": "./",
  "saveFile": true,
  "contentFile": "export.json",
  "includeDrafts": false,
  "includeArchived": false,
  "skipContentModel": false,
  "skipContent": false,
  "skipRoles": false,
  "skipWebhooks": false,
  "contentOnly": false,
  "queryEntries": ["content_type=convertTest"],
  "downloadAssets": false,
  "host": "api.contentful.com",
  "maxAllowedLimit": 1000,
  "errorLogFile": "./error.log",
  "useVerboseRenderer": false
}

Environment

Node Version: v18.7.0 Npm Version: 8.15.0 Operating System: macOS 12.4 (21F79) Monterey Package Version: [email protected]

empatel96 avatar Jul 28 '22 12:07 empatel96

+1 I am experiencing this issue as well

rmberg avatar Jul 29 '22 17:07 rmberg

I should probably add or change the text to: "queryEntries" doesn't actually filter anything. e.g. "queryEntries": ["sys.id=8Dos2GgHE0uTZJR6SIqOaX"], still returns all content

empatel96 avatar Aug 05 '22 15:08 empatel96

+1

jonmckee avatar Aug 31 '22 22:08 jonmckee

+1, there's not even a single example on the documentation on how should we query using the query-entries.

joaofmartinho avatar Oct 27 '22 11:10 joaofmartinho

See following links with the syntax for querying and search API documentation:

  • https://github.com/contentful/contentful-export#querying
  • https://www.contentful.com/developers/docs/references/content-delivery-api/#/reference/search-parameters

Related to #173.

wkruse avatar Mar 30 '23 08:03 wkruse

+1

a-pedroso avatar Mar 31 '23 09:03 a-pedroso

I was able to filter two content types with:

"queryEntries": ["sys.contentType.sys.id[in]=contentTypeOne,contentTypeTwo"],

nlitwin avatar Apr 11 '23 18:04 nlitwin

a working answer has been provided, will close this for now

marcolink avatar Jun 08 '23 13:06 marcolink