Integration problems

Answered

I followed this guide to perform integration via OAuth

https://www.jetbrains.com/help/hub/2.5/Resource-Owner-Password-Credentials.html

For my requirements, I need to create service programmatically. So, as in guide said I send second request:

POST https://gersaf.myjetbrains.com/hub/api/rest/services

with any attributes or without them at all it responds with:

Unexpected character ('-' (code 45)) in numeric value: expected digit (0-9) to follow minus sign, for valid numeric value at [Source: org.glassfish.jersey.message.internal.ReaderInterceptorExecutor$UnCloseableInputStream@10a0693; line: 1, column: 3]

 

1 comment
Comment actions Permalink
Official comment

Hello Rostislav, I'm very sorry for the delay.

If you'd like to create services, you should use this guide:  https://www.jetbrains.com/help/hub/2.5/HUB-REST-API_Services_Create-New-Service.html

You need to add body with a json containing description of the service being created to the POST request. Only name field is required. In addition, the request should have Authorization header with `Basic Base64(username + ":" + password)` (username and password are from the user who creates the service)

Here is an example of a request that should create a service:

curl -X POST -d '{ "name": "My New Service" }' --insecure --header "Content-type: application/json" --header "Authorization: Basic YOUR_BASE_64" https://HUB_REST_API/services

You will get something like this in response:

{
"type": "service",
"id": "af7ce82f-adaa-4a50-a28f-092bb0a3f531",
"name": "My New Service",
"key": "my-new-service",
"verified": false,
"trusted": false,
"secret": "crYW9CqRo8"
}

 

 

Please sign in to leave a comment.