# Update a project PATCH https://api.prolific.com/api/v1/projects/{project_id}/ Content-Type: application/json Update a project's details Reference: https://beta-docs.prolific.com/api-reference/projects/update-project ## OpenAPI Specification ```yaml openapi: 3.1.1 info: title: Update a project version: endpoint_projects.UpdateProject paths: /api/v1/projects/{project_id}/: patch: operationId: update-project summary: Update a project description: Update a project's details tags: - - subpackage_projects parameters: - name: project_id in: path description: Project id required: true schema: type: string - name: Authorization in: header description: Header authentication of the form `undefined ` required: true schema: type: string responses: '200': description: Updated project redirect link content: application/json: schema: $ref: '#/components/schemas/Project' '400': description: Error content: {} requestBody: content: application/json: schema: $ref: '#/components/schemas/Project' components: schemas: WorkspaceUser: type: object properties: id: type: string description: Id of user name: type: string description: Name of user email: type: string description: email of user roles: type: array items: type: string description: User roles in workspace required: - id Project: type: object properties: id: type: string description: Project id. It is created by Prolific. title: type: string description: Name of project description: type: string description: What is this project used for owner: type: string description: User id of the creator of the project. It is created by Prolific. users: type: array items: $ref: '#/components/schemas/WorkspaceUser' description: Data for all users who have access to this project workspace: type: string description: Id of the workspace this project is in. This is created by Prolific. naivety_distribution_rate: type: - number - 'null' format: double description: The rate at which the studies within this project are distributed. required: - id - title ``` ## SDK Code Examples ```python import requests url = "https://api.prolific.com/api/v1/projects/project_id/" payload = { "id": "63722982f9cc073ecc730f6b", "title": "My new project" } headers = { "Authorization": "", "Content-Type": "application/json" } response = requests.patch(url, json=payload, headers=headers) print(response.json()) ``` ```javascript const url = 'https://api.prolific.com/api/v1/projects/project_id/'; const options = { method: 'PATCH', headers: {Authorization: '', 'Content-Type': 'application/json'}, body: '{"id":"63722982f9cc073ecc730f6b","title":"My new project"}' }; 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://api.prolific.com/api/v1/projects/project_id/" payload := strings.NewReader("{\n \"id\": \"63722982f9cc073ecc730f6b\",\n \"title\": \"My new project\"\n}") req, _ := http.NewRequest("PATCH", 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://api.prolific.com/api/v1/projects/project_id/") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Patch.new(url) request["Authorization"] = '' request["Content-Type"] = 'application/json' request.body = "{\n \"id\": \"63722982f9cc073ecc730f6b\",\n \"title\": \"My new project\"\n}" response = http.request(request) puts response.read_body ``` ```java HttpResponse response = Unirest.patch("https://api.prolific.com/api/v1/projects/project_id/") .header("Authorization", "") .header("Content-Type", "application/json") .body("{\n \"id\": \"63722982f9cc073ecc730f6b\",\n \"title\": \"My new project\"\n}") .asString(); ``` ```php request('PATCH', 'https://api.prolific.com/api/v1/projects/project_id/', [ 'body' => '{ "id": "63722982f9cc073ecc730f6b", "title": "My new project" }', 'headers' => [ 'Authorization' => '', 'Content-Type' => 'application/json', ], ]); echo $response->getBody(); ``` ```csharp var client = new RestClient("https://api.prolific.com/api/v1/projects/project_id/"); var request = new RestRequest(Method.PATCH); request.AddHeader("Authorization", ""); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"id\": \"63722982f9cc073ecc730f6b\",\n \"title\": \"My new project\"\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift import Foundation let headers = [ "Authorization": "", "Content-Type": "application/json" ] let parameters = [ "id": "63722982f9cc073ecc730f6b", "title": "My new project" ] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api.prolific.com/api/v1/projects/project_id/")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "PATCH" 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() ```