Jump to content


Clutchplate

Member Since 18 Dec 2018
Offline Last Active Jan 11 2019 07:22 PM
-----

Posts I've Made

In Topic: Swarm API: C# API access

11 January 2019 - 07:26 PM

Ok, I got some help from colleagues and WebRequest is not really the right fit for this. Here's what does work:

_httpClient = new HttpClient { BaseAddress = new Uri(@"http://p4swarm") };
var authString = Convert.ToBase64String(Encoding.ASCII.GetBytes($"{Environment.UserName}:{P4SwarmToken}"));
_httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", authString);
...
var p4Response = await _httpClient.GetAsync(@"api/v9/reviews");
 

- Lutz

In Topic: Swarm API: C# API access

10 January 2019 - 09:43 PM

Using Fiddler to look at the network traffic, Swarm does not even do an Authentication challenge. And sending the Authorization header has no effect either.

In Topic: Swarm API: Who approved the review

19 December 2018 - 07:25 PM

The activity version does work for me, though, so I'll use that. Thanks!

In Topic: Swarm API: Who approved the review

19 December 2018 - 07:21 PM

Thanks for the reply.
I am using the Swarm API to retrieve this data. The API docs REALLY could use some TLC. I don't see "approvals" as a field anywhere, in fact none of the commands list the available fields for each command.

However, this does not work for my server.

When I issue
http://p4swarm/api/v9/reviews/4139412?fields=id,state,approvals

I get this back:
{"review":{"id":4139412,"state":"approved"}}

I get the same result if I leave off "approvals" from the fields. And leaving off the fields spec entirely, it also does not return approvals either.

The "version" command returns:
{"apiVersions":[1,1.1,1.2,2,3,4,5,6,7,8,9],"version":"SWARM\/2018.1\/1660025 (2018\/05\/09)","year":"2018"}

Is this something that can be configured on the server?