Not able to trigger REST call from deployment section

We are using CircleCI to build our various projects. In one of our project, we need to trigger a build of other repository in case current build one is green.
Say, if repo A’s build is green, trigger repo B’s build.

For triggering the build I am using REST API of CircleCI and can successfully trigger new build using it. My concern is, when I make a call from test section it works, but while making same call form deployment section it’s not working.

I want to use the same in deployment section to make sure it will be triggered in case of successful build only.

Example,

Working code:
test:
override:

Non-working code:

deployment:
development:
branch: $CIRCLE_BRANCH
commands:

Any thoughts on this why its not working ?

Were you able to solve this issue?