# Get user by username GET https://api.plantstore.dev/v3/user/{username} Retrieve user details using their username. Reference: https://plantstore.dev/api-reference/plant-store-api/users/get-user-by-name ## OpenAPI Specification ```yaml openapi: 3.1.1 info: title: Get user by username version: endpoint_user.getUserByName paths: /user/{username}: get: operationId: get-user-by-name summary: Get user by username description: Retrieve user details using their username. tags: - - subpackage_user parameters: - name: username in: path description: Username of the user to retrieve required: true schema: type: string responses: '200': description: User details retrieved successfully content: application/json: schema: $ref: '#/components/schemas/User' components: schemas: User: type: object properties: id: type: integer username: type: string email: type: string ``` ## SDK Code Examples ```python import requests url = "https://api.plantstore.dev/v3/user/username" response = requests.get(url) print(response.json()) ``` ```javascript const url = 'https://api.plantstore.dev/v3/user/username'; const options = {method: 'GET'}; 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" "net/http" "io" ) func main() { url := "https://api.plantstore.dev/v3/user/username" req, _ := http.NewRequest("GET", url, nil) 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.plantstore.dev/v3/user/username") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Get.new(url) response = http.request(request) puts response.read_body ``` ```java HttpResponse response = Unirest.get("https://api.plantstore.dev/v3/user/username") .asString(); ``` ```php request('GET', 'https://api.plantstore.dev/v3/user/username'); echo $response->getBody(); ``` ```csharp var client = new RestClient("https://api.plantstore.dev/v3/user/username"); var request = new RestRequest(Method.GET); IRestResponse response = client.Execute(request); ``` ```swift import Foundation let request = NSMutableURLRequest(url: NSURL(string: "https://api.plantstore.dev/v3/user/username")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "GET" 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() ```