1

I have created a Watson Assistant service and created a simple action bot. My aim is to control the amount of user that can access the service monthly. Checking on the API Docs I found out that is possible to update my environment to disable my action skill and block users to use the bot. However I am facing some issues regarding API use.

I have created a version and deploy it on my live environment. I tried to update my draft and live environment with this API:

/v2/assistants/{assistant_id}/environments/{environment_id}
{
    "skill_references": [{
        "skill_id": "my skill id",
        "type": "action",
        "disabled": true,
        "snapshot": "2",
        "skill_reference": "actions skill"
    }]
}

I am getting the following response:

{
    "error": "Data Exception: Skill References can not be deleted. The cardinality of the skill_references (1) is less than expected: (2)",
    "code": 400
}

Do you guys know if I can disabled my live or draft environment or have any idea on how to make the service unavailable after hit the maximum amount of user?

Joao Pedro P.P
  • 125
  • 2
  • 7

1 Answers1

1

The entire body of skill_references needs to be supplied on an Update environment call.

You can get the full array of skill_references by first performing a GET /v2/assistants/{{assistant_id}}/environments/{{environment_id}}, and then changing the disabled state on the action skill reference.

Based on your error, I think what you're missing from the Update request is the skill_reference for your search skill, which is created by default for every environment.

Jeremy Caney
  • 7,102
  • 69
  • 48
  • 77
R L
  • 11
  • 1
  • It worked partially, when I supplied the entire body of `skill_references` the API returned 200, however the skill was not disabled. I mean, I tried to disabled the entire live environment and although the API returned 200 I still able to chat with my assistant. – Joao Pedro P.P May 25 '23 at 13:23