reportportal / service-api

Report portal. Main API Service

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Endpoint POST /api/v*/{project-name}/launch returns UUID instead of ID of the newly created launch

tzahialt opened this issue · comments

endpoint POST /api/v*/{project-name}/launch returns UUID instead of ID of the newly created launch.

This is observed in v5 service-api, for both v1 and v2 api endpoints, and with both sync and async invocations.

The root cause can be easily spotted in :

  1. https://github.com/reportportal/service-api/blob/develop/src/main/java/com/epam/ta/reportportal/core/launch/impl/StartLaunchHandlerImpl.java : line 85

  2. https://github.com/reportportal/service-api/blob/develop/src/main/java/com/epam/ta/reportportal/core/launch/impl/StartLaunchHandlerAsyncImpl.java : line 66

referring to develop and master branches, and to tag 5.3.0

The problem is that when the client wants to obtain a launch URL, it gets one that is not accepted by the client, because it ends with the uuid rather than the id of the new launch (in v4 this was the correct URL, but in v5 it seems like the correct URL should end with the launch ID, not UUID).

Or is the bug actually on the UI side ? come to think of it, it make more sense that the breaking change was in the UI end, exposing the launch via it's internal repository id rather than its UUID.

For example :

POST https://il-reportportal-lp1/api/v2/tzahia_personal/launch with body
{
"mode":0,
"name":"AI635x",
"startTime":1598363771611
}

returns a response as :
{
"id": "62e58332-a0c1-4497-b910-114a401d9f1d",
"number": null
}

creates a launch who's UI URL is something like :
https://il-reportportal-lp1/ui/#tzahia_personal/launches/all/**2289**

Some additional info...

The flow I'm trying to have (and which I had working in v4) is to be able to obtain the newly created launch's UI URL, as soon as it's created, using the client-java library.

When calling the POST launch REST endpoint, it returns the launch's UUID, but not the id.
I use that information to calculate the launch's UI URL, but starting v5, the that URL has changed, as described above, and thus my calculated URL in incorrect.

I did find a solution in v5, by using com.epam.reportportal.service.ReportPortalClient#getLaunchByUuid from report-portal-client java (seems like this is a new method in v5, possibly aimed at scenarios similar to mine). But I feel like this is not an optimal solution, for two reasones :

  1. It forces me to invoke an additional API call against the server.
  2. The UI URL convention is still changed compared to v4 - was this intentional ?