mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-11-05 11:13:46 +00:00
* Add setting for generating the oneOf interfaces as sealed interfaces * Generate samples * Add internal java17 additionalProperty setting * Move samples to highlight that they do not use the petstore * Align documentation * Update samples * Align documentation * Update mustache files and samples to change gradle settings to java17
1.8 KiB
1.8 KiB
BarApi
All URIs are relative to http://localhost:8080
| Method | HTTP request | Description |
|---|---|---|
| createBar | POST /bar | Create a Bar |
createBar
Bar createBar(barCreate)
Create a Bar
Example
// Import classes:
import org.openapitools.client.ApiClient;
import org.openapitools.client.ApiException;
import org.openapitools.client.Configuration;
import org.openapitools.client.models.*;
import org.openapitools.client.api.BarApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("http://localhost:8080");
BarApi apiInstance = new BarApi(defaultClient);
BarCreate barCreate = new BarCreate(); // BarCreate |
try {
Bar result = apiInstance.createBar(barCreate);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling BarApi#createBar");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| barCreate | BarCreate |
Return type
Authorization
No authorization required
HTTP request headers
- Content-Type: application/json
- Accept: application/json
HTTP response details
| Status code | Description | Response headers |
|---|---|---|
| 200 | Bar created | - |