# Atualizar grupo PUT https%3A%2F%2Fwww.sitedaempresa.com.br/_functions/@fw2sites/fw2-propaganda-backend/v1/groups/ Content-Type: application/json Atualiza um grupo existente. 🔎 **Notas** - Envie o objeto completo/partial dentro de `data`. - O `_id` do grupo é obrigatório no payload (mesmo havendo `{{id}}` na URL). Reference: https://api.fw2propaganda.com.br/api-fw-2-propaganda-v-1/grupos/atualizar-grupo ## OpenAPI Specification ```yaml openapi: 3.1.0 info: title: collection version: 1.0.0 paths: /_functions/@fw2sites/fw2-propaganda-backend/v1/groups/: put: operationId: atualizar-grupo summary: Atualizar grupo description: >- Atualiza um grupo existente. 🔎 **Notas** - Envie o objeto completo/partial dentro de `data`. - O `_id` do grupo é obrigatório no payload (mesmo havendo `{{id}}` na URL). tags: - subpackage_grupos parameters: - name: Authorization in: header required: true schema: type: string responses: '200': description: Successful response content: application/json: schema: $ref: '#/components/schemas/Grupos_Atualizar grupo_Response_200' requestBody: content: application/json: schema: type: object properties: data: $ref: >- #/components/schemas/FunctionsFw2SitesFw2PropagandaBackendV1GroupsPutRequestBodyContentApplicationJsonSchemaData required: - data servers: - url: https%3A%2F%2Fwww.sitedaempresa.com.br components: schemas: FunctionsFw2SitesFw2PropagandaBackendV1GroupsPutRequestBodyContentApplicationJsonSchemaData: type: object properties: _id: type: string format: uuid type: type: string format: uuid title: type: string required: - _id - type - title title: >- FunctionsFw2SitesFw2PropagandaBackendV1GroupsPutRequestBodyContentApplicationJsonSchemaData Grupos_Atualizar grupo_Response_200: type: object properties: {} description: Empty response body title: Grupos_Atualizar grupo_Response_200 securitySchemes: apiKeyAuth: type: apiKey in: header name: Authorization ``` ## SDK Code Examples ```python import requests url = "https://api.example.com/_functions/@fw2sites/fw2-propaganda-backend/v1/groups/" payload = { "data": { "_id": "11111111-2222-3333-4444-555555555555", "type": "11111111-2222-3333-4444-555555555555", "title": "Categoria Atualizada" } } headers = { "Authorization": "", "Content-Type": "application/json" } response = requests.put(url, json=payload, headers=headers) print(response.json()) ``` ```javascript const url = 'https://api.example.com/_functions/@fw2sites/fw2-propaganda-backend/v1/groups/'; const options = { method: 'PUT', headers: {Authorization: '', 'Content-Type': 'application/json'}, body: '{"data":{"_id":"11111111-2222-3333-4444-555555555555","type":"11111111-2222-3333-4444-555555555555","title":"Categoria Atualizada"}}' }; 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.example.com/_functions/@fw2sites/fw2-propaganda-backend/v1/groups/" payload := strings.NewReader("{\n \"data\": {\n \"_id\": \"11111111-2222-3333-4444-555555555555\",\n \"type\": \"11111111-2222-3333-4444-555555555555\",\n \"title\": \"Categoria Atualizada\"\n }\n}") req, _ := http.NewRequest("PUT", 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.example.com/_functions/@fw2sites/fw2-propaganda-backend/v1/groups/") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Put.new(url) request["Authorization"] = '' request["Content-Type"] = 'application/json' request.body = "{\n \"data\": {\n \"_id\": \"11111111-2222-3333-4444-555555555555\",\n \"type\": \"11111111-2222-3333-4444-555555555555\",\n \"title\": \"Categoria Atualizada\"\n }\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.put("https://api.example.com/_functions/@fw2sites/fw2-propaganda-backend/v1/groups/") .header("Authorization", "") .header("Content-Type", "application/json") .body("{\n \"data\": {\n \"_id\": \"11111111-2222-3333-4444-555555555555\",\n \"type\": \"11111111-2222-3333-4444-555555555555\",\n \"title\": \"Categoria Atualizada\"\n }\n}") .asString(); ``` ```php request('PUT', 'https://api.example.com/_functions/@fw2sites/fw2-propaganda-backend/v1/groups/', [ 'body' => '{ "data": { "_id": "11111111-2222-3333-4444-555555555555", "type": "11111111-2222-3333-4444-555555555555", "title": "Categoria Atualizada" } }', 'headers' => [ 'Authorization' => '', 'Content-Type' => 'application/json', ], ]); echo $response->getBody(); ``` ```csharp using RestSharp; var client = new RestClient("https://api.example.com/_functions/@fw2sites/fw2-propaganda-backend/v1/groups/"); var request = new RestRequest(Method.PUT); request.AddHeader("Authorization", ""); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"data\": {\n \"_id\": \"11111111-2222-3333-4444-555555555555\",\n \"type\": \"11111111-2222-3333-4444-555555555555\",\n \"title\": \"Categoria Atualizada\"\n }\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift import Foundation let headers = [ "Authorization": "", "Content-Type": "application/json" ] let parameters = ["data": [ "_id": "11111111-2222-3333-4444-555555555555", "type": "11111111-2222-3333-4444-555555555555", "title": "Categoria Atualizada" ]] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api.example.com/_functions/@fw2sites/fw2-propaganda-backend/v1/groups/")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "PUT" 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() ```