TWC REST API

Discussions about Teamwork Cloud and Teamwork Server functionalities

Moderator: Moderators

TWC REST API

Postby pwa0001@uah.edu » Thu Oct 10, 2019 1:21 pm

I would like to log into TWC from the REST API.

The REST API shows a post request /osmc/login and it executes as expected from the swagger interface. When I try to execute the
curl command generated from the successful swagger request, I receive an "Unauthorized. The request requires user authentication." response.

Does anyone have any experience with this or know what might be happening?

Thanks
pwa0001@uah.edu
Forum Newbie
Forum Newbie
 
Posts: 2
Posts Rating:0
Joined: Fri May 11, 2018 12:56 pm

Re: TWC REST API

Postby thomas.payne@navy.mil » Thu Dec 19, 2019 3:36 pm

Using a TWC configured for username/password authentication, my experience is when I access the twc_url:port/osmc URL, swagger presents an "Authorize" button. Clicking the Authorize button presents a username/password dialog box. When I try the "GET /osmc/workspaces" command, the curl command includes -H "authorization: Basic ..." where ... is the encrypted username/password.
In Java it would look like:
package myPackage;
import io.restassured.RestAssured;
import io.restassured.response.Response;
public class myClass{
public static void main(String[] args) {
RestAssured.baseURI = "twc_url:port/osmc";
RestAssured.authentication = RestAssured.basic(username,password);
RequestSpecification httpRequest = RestAssured.given();
Response response = httpRequest.get("/workspaces?includeBody=true");
}
}
thomas.payne@navy.mil
Forum Newbie
Forum Newbie
 
Posts: 6
Posts Rating:1
Joined: Fri Mar 30, 2018 12:13 pm


Return to Teamwork Cloud and Teamwork Server

Who is online

Users browsing this forum: No registered users and 0 guests