Bad Request sending a new requets on ServiceDesk

Hello there:

I’m trying to create a request using REST API for ServiceDesk, using Basic Auth (because I’m using a customer account). I was able to read issues, send comments, and even upload attachments, but when I try to send a new request, a “Bad Request” http error is sent back.
I’m using C#, and I’m using this model to send data:

public class NewRequestModel
{
        public string serviceDeskId { get; set; }
        public string requestTypeId { get; set; }
        public Dictionary<string, object> requestFieldValues { get; set; }
}

Inside Dictionary, I’m adding a “summary” field, a “description” field and “customfield_11319” (I’ll explain later.
Then, I send the info using this code:

public async Task<RequestModel> SendIssueAsync(string serviceDeskToken, NewRequestModel requetsModel)
        {
            HttpResponseMessage response = null;
            HttpClient client = new HttpClient
            {
                BaseAddress = new Uri("https://mycompany.atlassian.net")
            };
            HttpContent content;
            string urlParams = "";
            RequestModel modelo = null;
            string tempString;

            try
            {
                //Setting header as JSON
                client.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json"));
                //Añadiendo Token a la cabecera
                client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", serviceDeskToken);

                urlParams = serviceDeskRequestsUrl;
                //Añadiendo datos al contenido
                string jason = JsonConvert.SerializeObject(requetsModel, new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore });
                content = new StringContent(jason, System.Text.Encoding.UTF8, "application/json");

                //Envío del mensaje
                response = await client.PostAsync(urlParams, content);
                
                if (response.StatusCode == System.Net.HttpStatusCode.Created)
                {
                    tempString = await response.Content.ReadAsStringAsync();
                    modelo = JsonConvert.DeserializeObject<RequestModel>(tempString);
                }
            }
            catch (Exception)
            {
                throw;
            }

            return modelo;
        }

Where “serviceDeskRequestUrl” is “/rest/servicedeskapi/request”.
I followed the guide in https://developer.atlassian.com/cloud/jira/service-desk/rest/api-group-request/#api-rest-servicedeskapi-request-post
Also, I was not sure that I sent all required data, so I made a request to “get request type fields”
https://developer.atlassian.com/cloud/jira/service-desk/rest/api-group-servicedesk/#api-rest-servicedeskapi-servicedesk-servicedeskid-requesttype-requesttypeid-field-get

“canRaiseOnBehalfOf” returns false, and “canAddRequestParticipants” returns false too. As for “requestTypeFields”, it tolds me that “summary” is required, and “customfield_11319” too (that’s why I added to the dictionary).
I tried any combination I can think of. I put all dictionary values as strings, and “customfield_11319” as an int, but always a BadRequest error.

Also, I tried to put Authorization header from basic to “Bearer”, as said in API, but sent me a “Unauthorized” http error (I expected that, because I’m using Basic Auth, not OAuth).

So, can someone figure it out what am I doing wrong?
Thank you!

It looks like I need to add this to the model:

public List<string> requestParticipants { get; set; }
public string raiseOnBehalfOf { get; set; }

And add not null values (just empty ones) just to not get the “Bad Request” error.

Now I have a “Forbidden” error. Customer has permission to create requests on our portal, so I don’t know if it’s an APP configuration issue, a Jira configuration problem…

No, I didn’t fix this at all.
Reading this:
https://developer.atlassian.com/cloud/jira/service-desk/rest/intro/#authentication
In “status codes and responses” says that I can get a description of the error. So I deleted the two last fileds I created and now I’m getting this error:
“The field ‘customfield_11319’ with the name ‘consumo horas’ has these errors: specify the value for consumo horas in a matrix”.
So I did this:

data.requestModel.requestFieldValues.Add("customfield_11319", List<string>() { 10494 } );

So then it asked me to put in an object…

When I asked for “get request type fields”, I got this JSON

{
	"requestTypeFields": [{
			"fieldId": "summary",
			"name": "Resumen",
			"description": "",
			"required": true,
			"defaultValues": [],
			"validValues": [],
			"jiraSchema": {
				"type": "string",
				"system": "summary"
			},
			"visible": true
		}, {
			"fieldId": "customfield_11319",
			"name": "Consumo horas",
			"description": "",
			"required": true,
			"defaultValues": [{
					"value": "10494",
					"label": "Soporte",
					"children": []
				}
			],
			"validValues": [{
					"value": "10494",
					"label": "Soporte",
					"children": []
				}, {
					"value": "10495",
					"label": "Bolsa Desarrollo",
					"children": []
				}, {
					"value": "10496",
					"label": "Presupuesto",
					"children": []
				}, {
					"value": "10499",
					"label": "Fuera de soporte",
					"children": []
				}, {
					"value": "10500",
					"label": "Proyecto",
					"children": []
				}
			],
			"jiraSchema": {
				"type": "array",
				"items": "option",
				"custom": "com.atlassian.jira.plugin.system.customfieldtypes:multicheckboxes",
				"customId": 11319
			},
			"visible": true
		}
	],
	"canRaiseOnBehalfOf": false,
	"canAddRequestParticipants": false
}

How do I send the customfield value?

Ok, like this:

data.requestModel.requestFieldValues.Add("customfield_11319", new List<Dictionary<string, string>>() { new Dictionary<string, string>() { { "id", "10494" } } });

Now, some Issue types don’t let me add a comment, I have so send the data without that field… and it makes no sense.
Also, I need to send a priority value.