Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Crucible Rest API stop/start repository failed

I have generated Rest API token under Authentication Setting of Administartion page.

And Using:

curl -X POST -H "X-Api-Key: YOUR-API-TOKEN-HERE"  http://SERVER:PORT/CONTEXT/rest-service-fecru/admin/repositories-v1/REPOSITORY-NAME/scan

scan repository succeed!

But using :

curl -X POST -H "X-Api-Key: 01be8038370e66521e685685f0dc6078f625f577"  http://192.168.1.210:8060/rest-service-fecru/admin/repositories-v1/repo1/stop

always return :

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<status>
<status-code>401</status-code>
<message>Client must be authenticated to access this resource.</message>
</status>

How should I solve this issue?

1 answer

1 accepted

1 vote
Answer accepted
Nick Atlassian Team Mar 19, 2013

Hi Fei Wang,

The Rest API token can only currently be used with the /scan REST endpoint.

You will need to use another auth type (such as BASIC) if you wish to access other admin REST endpoints.

If you are using curl, then supply the username/password like so:

curl -u username:password ...

Cheers,

Nick

Thank you very much!I tested successfully !

But still it's strange.I used 3 accounts testing : root /usr1/usr2 .

user1 is built-in account.user2 is from LDAP. These 2 accounts are belong admin group.

Only user1 can get right response.

curl -X POST -u user1:testpwd http://192.168.1.210:8060/rest-service-fecru/admin/repositories-v1/repo1/stop

response:
{"name":"repo1","state":"STOPPED","enabled":true,"indexingStatus":{"linesOfContentIndexingInProgress":false,"error":false,"fullIndexingInProgress":false,"lastScanTime":1363829468005,"incrementalIndexingInProgress":false}}

curl -X POST -u user2:testpwd http://192.168.1.210:8060/rest-service-fecru/admin/repositories-v1/repo1/stop

response:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?><status><status-code>401</status-code><message>Client must be authenticated to access this resource.</message>

curl -X POST -u root:rootpwd http://192.168.1.210:8060/rest-service-fecru/admin/repositories-v1/repo1/stop

response:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?><status><status-code>401</status-code><message>Client must be authenticated to access this resource.</message>

Why did this happen?

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Marketplace Apps & Integrations

Bitbucket Smart Commits vs. Genius Commits - What's the difference?

If you already heard about Smart Commits in Bitbucket, know that you just stumbled upon something even better (and smarter!): Genius Commits by Better DevOps Automation for Jira Data Center (+ Server...

114 views 0 2
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you