0

Utilizing the Watson Studio GUI, I have no problems creating a Studio project and integrating it with a git repo. I need to script this process. When using the Watson Data API (2.23.1), I can indeed create a project using the .../transactional/v2/projects REST call, but that call doesn't appear to have any git related info in its payload.

After creating the project (not yet integrated with git), I then try issuing this REST call: .../v2/asset_files/git_transactions/remote passing the newly created project.

Its payload contains git info, so I assume it's the one to use to integrate the project with GIT:

{"repo_url": "https://github.ibm.com/orgn/xxxx.git","access_token":{"git_host":"GitHub Enterprise","token_value":"xxxxxxxxxxxxx" }}

But this call always fails with:

{"code":400,"error":"Bad Request","reason":"Invalid request body, access_token format is not valid","message":"The server cannot or will not process the request due to an apparent client error (e.g. malformed request syntax)."}

The message mentions the access_token format being invalid, but I'm following the api documentation wrt format.

Any guidance would be appreciated.

Ricardo Gonzalez
  • 1,827
  • 1
  • 14
  • 25

3 Answers3

0

Have you seen the Swagger doc for Watson Studio projects at: https://api.dataplatform.cloud.ibm.com/v2/projects/docs/swagger/#/

If so, you will see that you can include the GH integration in your project creation step.

You can use the GetProject API to grab the JSON from your working project with the GH integration already working to confirm the schema required.

  • Unfortunately, while the Swagger doc suggests it would support "github" as element in the Post, I receive an "Extraneous properties: github" message when I include it. – desimonemike Mar 21 '20 at 20:47
  • Note: I have just confirmed with a watson studio developer that the REST API currently doesn't support project GIT integration. – desimonemike Mar 23 '20 at 17:59
0

Apologies, you are correct that the /transactional/v2/projects api endpoint does not support including GitHub integration whereas the /v2/projects api endpoint does but it is not the recommended one to use programmatically.

That said, there is a update API which will allow you to add your GitHub integration to your newly created project which you created via the transactional/v2/projects api assuming that you have already added your GitHub access token to your Watson Studio Setting as per Enable access to GitHub from your account

You can simply pass the body:

{
"github": {
        "repository": "https://github.ibm.com/orgn/xxxx.git"
         }
}

And your project will be updated accordingly.

-1

I've tried to update project which created via the transaction/v2/projects api and already added GitHub access token.

After that I can see that it is applied it (/v2/projects/{projects id}), but it is not applied Integrations section in Projects setting page. I think it is not being update to backend pod.

  • This does not looks like an answer at all but just a small footsteps. Please consider reading this : https://stackoverflow.com/help/how-to-answer – Welgriv Aug 24 '21 at 15:38