Getting Error 400 Bad Request for Put Request

Hello,
i am trying to do a put request to the Jira API via a c++ script.
I am using the c++ library “httplib” which works for Get Request.

My headers are looking like that:

httplib::Headers headers = {
            {"Accept", "application/json"},
			{"Content-Type", "application/json"},
			{"Authorization", "Basic " + getKey()},
	};

My Put request looks like that:

httplib::Client cli(_baseUrl.c_str());
	std::string url = "/rest/api/2/issue/CTUS-3701";

    std::string body = "{\"fields\":{\"summary\":\"TestTestTest\"}}";

    size_t bodySize = body.size();

    auto res = cli.Put(url.c_str(), createHeaders(), body.c_str(), bodySize, "application/json");

Every time i do that request i get the error code “400 Bad Request” without any other error message.

If i do the same request via a different tool like Postman it is working as its supposed to do.

Thanks for any help in advance!

@HaukeFranek welcome to the Atlassian developer community.

My C++ might be a bit rusty, but how does baseUrl get prepended to the url?

The baseurl gets prepended to the url inside of the Put function. I use the same library for the Zephyr Rest API and there Put and Post work well.