# Add a comment POST https://app.unleash-instance.example.com/api/admin/projects/{projectId}/change-requests/{id}/comments Content-Type: application/json **Enterprise feature** This endpoint will add a comment to a change request for the user making the request. Reference: https://docs.getunleash.io/api/add-change-request-comment ## OpenAPI Specification ```yaml openapi: 3.1.1 info: title: This endpoint will add a comment to a change request version: endpoint_changeRequests.addChangeRequestComment paths: /api/admin/projects/{projectId}/change-requests/{id}/comments: post: operationId: add-change-request-comment summary: This endpoint will add a comment to a change request description: >- **Enterprise feature** This endpoint will add a comment to a change request for the user making the request. tags: - - subpackage_changeRequests parameters: - name: projectId in: path required: true schema: type: string - name: id in: path required: true schema: type: string - name: Authorization in: header description: Header authentication of the form `undefined ` required: true schema: type: string responses: '204': description: This response has no body. content: application/json: schema: $ref: >- #/components/schemas/Change Requests_addChangeRequestComment_Response_204 requestBody: description: changeRequestAddCommentSchema content: application/json: schema: $ref: '#/components/schemas/changeRequestAddCommentSchema' components: schemas: changeRequestAddCommentSchema: type: object properties: text: type: string description: The content of the comment. required: - text Change Requests_addChangeRequestComment_Response_204: type: object properties: {} ``` ## SDK Code Examples ```python import requests url = "https://app.unleash-instance.example.com/api/admin/projects/projectId/change-requests/id/comments" payload = { "text": "This is a comment" } headers = { "Authorization": "", "Content-Type": "application/json" } response = requests.post(url, json=payload, headers=headers) print(response.json()) ``` ```javascript const url = 'https://app.unleash-instance.example.com/api/admin/projects/projectId/change-requests/id/comments'; const options = { method: 'POST', headers: {Authorization: '', 'Content-Type': 'application/json'}, body: '{"text":"This is a comment"}' }; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://app.unleash-instance.example.com/api/admin/projects/projectId/change-requests/id/comments" payload := strings.NewReader("{\n \"text\": \"This is a comment\"\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("Authorization", "") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` ```ruby require 'uri' require 'net/http' url = URI("https://app.unleash-instance.example.com/api/admin/projects/projectId/change-requests/id/comments") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["Authorization"] = '' request["Content-Type"] = 'application/json' request.body = "{\n \"text\": \"This is a comment\"\n}" response = http.request(request) puts response.read_body ``` ```java import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.post("https://app.unleash-instance.example.com/api/admin/projects/projectId/change-requests/id/comments") .header("Authorization", "") .header("Content-Type", "application/json") .body("{\n \"text\": \"This is a comment\"\n}") .asString(); ``` ```php request('POST', 'https://app.unleash-instance.example.com/api/admin/projects/projectId/change-requests/id/comments', [ 'body' => '{ "text": "This is a comment" }', 'headers' => [ 'Authorization' => '', 'Content-Type' => 'application/json', ], ]); echo $response->getBody(); ``` ```csharp using RestSharp; var client = new RestClient("https://app.unleash-instance.example.com/api/admin/projects/projectId/change-requests/id/comments"); var request = new RestRequest(Method.POST); request.AddHeader("Authorization", ""); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"text\": \"This is a comment\"\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift import Foundation let headers = [ "Authorization": "", "Content-Type": "application/json" ] let parameters = ["text": "This is a comment"] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://app.unleash-instance.example.com/api/admin/projects/projectId/change-requests/id/comments")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "POST" request.allHTTPHeaderFields = headers request.httpBody = postData as Data let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ```