easysoft / easysoft/zentao-cli

bug: story create fails with 'Missing required parameter: productID' on ZenTao 22.3

Open Beginner friendly
#14 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
57
Forks
20
PR merge metrics
No merged PRs in 30d

Description

Describe the bug

zentao story create always fails on ZenTao 22.3 with error:

Error(E2008): Missing required parameter: productID.

To Reproduce

zentao login -s https://pm.clight.online -u admin -p <password>
zentao product create --name="TestProduct"
# Suppose product ID is 3
zentao story create --product=3 --title="test" --pri=1 --assignedTo=admin --spec="test"

Expected: Story created successfully.
Actual: Error(E2008): Missing required parameter: productID.

Root Cause

The CLI puts productID in the POST request body (JSON), but ZenTao 22.3 v2 API requires productID as a URL query parameter:

Approach Request Result
CLI (buggy) POST /api.php/v2/stories body: {"productID":3,...} ❌ Missing required parameter
Workaround POST /api.php/v2/stories?productID=3 body: {"title":"test",...} ✅ 保存成功

The URL in the error message confirms this — it shows .../api.php/v2/stories? with an empty query string, indicating the CLI tried to pass productID only in the body, not the URL.

Environment

  • zentao-cli: 0.1.8 (also reproduced on 0.1.7)
  • ZenTao: 22.3
  • OS: Windows 10 (git-bash)

Workaround

Pass productID in the URL manually via curl or script:

curl -X POST "https://<zentao>/api.php/v2/stories?productID=3" \
  -H "Content-Type: application/json" \
  -H "Token: <token>" \
  -d '{"title":"test","pri":1,"assignedTo":"admin","category":"feature","spec":"test"}'

Note

Other modules (product, project, user) work fine — only story is affected because its create endpoint requires productID which the CLI handles as a body parameter instead of a URL query parameter.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the story create command and the request construction for POST /api.php/v2/stories. Run the provided ZenTao 22.3 reproduction, then verify that productID is sent as a URL query parameter rather than only in the JSON body and that story creation succeeds.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
api, cli
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
75/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.