Getting 415 / 400 when querying test allocation via REST api

Hey,

I've been trying to create a test allocation for the last few days and I'm stuck now, on two seemingly independent problems.

  1. When using my browser to make the request, I get a status 400. I think I got past the authentication, because I am getting access denied if I change something in the request header (initially I assumed capitalization doesn't matter but it seems the authorization header value has to have a capital letter for Basic). The response I get now is: [quote] title "Bad Request" detail "error parsing 'application/json' request body: EOF" status 400 [/quote]

The body of the request is as follows. I generated the UUID for the allocation myself (my understanding is that's what I'm supposed to do). I currently have only one build, build config, and fleet. I got the build configuration id from the fleet's build configurations, and the region id from the scaling settings.
[quote]
{"allocationId":"fd57e0a4-3f4a-4971-8e0a-46dcdc506b20","buildConfigurationId":1232117,"regionId":"39c5ec34-896a-41f5-ab80-b03b4ef881e0"}
[/quote]

  1. When using UnityWebRequest, I keep getting a 415 Invalid Media Type, but I don't find anything that is wrongly configured (and I'm using the same links and headers for the request via the browser). This problem is the reason I started trying via the browser before trying to resolve it, because I thought perhaps I'm using the API wrong somehow.

The code for this:

    static async Task<AllocationRequestResponse> _QueueTestAllocationRequest(InitGameSessionServerData initServerData)
    {
        AllocationRequest payload;
        payload.allocationId = Guid.NewGuid().ToString();
        payload.buildConfigurationId = _buildConfigurationId;
        payload.payload = JsonUtility.ToJson(initServerData);
        payload.regionId = _regionId;
        payload.restart = false;
        string jsonPayload = JsonUtility.ToJson(payload);

        string path = _multiplayTestAllocationPath;
        string headerName = "Authorization";
        string headerValue = $"Basic {_keyIdAndSecret}";
        var tokenReq = new UnityWebRequest(path, UnityWebRequest.kHttpVerbPOST);
        tokenReq.SetRequestHeader(headerName, headerValue);
        tokenReq.uploadHandler = new UploadHandlerRaw(Encoding.UTF8.GetBytes(jsonPayload));

        var tokenOp = tokenReq.SendWebRequest();
        while (!tokenOp.isDone) await Task.Delay(100);

        if (tokenReq.responseCode != 202)
            Debug.LogError($"Queue test allocation request failed '{tokenReq.responseCode}': '{tokenReq.error}'");
        if (tokenReq.downloadHandler != null)
            return JsonUtility.FromJson<AllocationRequestResponse>(tokenReq.downloadHandler.text);
        return default;
    }

Of course, I double-checked all the links and IDs, and I even wrote them from scratch.
Any ideas are welcome!

Turns out I was missing a content-type header specifying application/json.. The web newbie mistake I suppose!