Apidog Docs
πŸ‡ΊπŸ‡Έ English
  • πŸ‡ΊπŸ‡Έ English
  • πŸ‡―πŸ‡΅ ζ—₯本θͺž
HomeLearning CenterSupport CenterAPI References
HomeLearning CenterSupport CenterAPI References
Discord Community
Slack Community
X / Twitter
πŸ‡ΊπŸ‡Έ English
  • πŸ‡ΊπŸ‡Έ English
  • πŸ‡―πŸ‡΅ ζ—₯本θͺž
  1. Develop and Debug APIs
  • Apidog Learning Center
  • Get started
    • Introduce Apidog
    • Basic concepts in Apidog
    • Navigating Apidog
    • Quick Start
      • Overview
      • Specify a new endpoint
      • Make a request to the endpoint
      • Add an assertion
      • Create a test scenario
      • Share your API documentation
      • Explore more
      • Send a request and save as an endpoint
    • Migration
      • Overview
      • Manual import
      • Scheduled import
      • Import options
      • Export data
      • Import from...
        • Import from Postman
        • Import OpenAPI (Swagger) spec
        • Import cURL
        • Import Markdowns
        • Import from Insomnia
        • Import from apiDoc
        • Import .har file
        • Import WSDL
  • Design APIs
    • Overview
    • Create a new API project
    • Endpoint basics
    • Components
    • Common fields
    • Global parameters
    • Endpoint change history
    • Batch endpoint management
    • Configure multiple request body examples
    • Schemas
      • Generate Schemas from JSON etc.
      • Build a schema
      • Overview
      • Create a new schema
    • Security schemes
      • Overview
      • Create a security scheme
      • Use the security scheme
      • Security scheme in online documentation
    • Advanced features
      • Custom endpoint fields
      • Import endpoints as test steps
      • Endpoint status
      • Appearance of parameter lists
      • Endpoint unique idenfication
  • Develop and Debug APIs
    • Overview
    • Generate requests
    • Send requests
    • Endpoint cases
    • Dynamic values
    • Validate responses
    • Design-first Mode & Request-first Mode
    • Generate code
    • Environments & variables
      • Overview
      • Using variables
      • Environments & services
    • Vault secrets
      • Overview
      • HashiCorp Vault
      • Azure Key Vault
      • AWS Secrets Manager
    • Pre/Post processors
      • Overview
      • Assertion
      • Extract variable
      • Wait
      • Database operations
        • Overview
        • MongoDB
        • Redis
        • Oracle Client
      • Using scripts
        • Overview
        • Postman scripts reference
        • Pre processor scripts
        • Post processor scripts
        • Public scripts
        • Calling other programming languages
        • Using JS libraries
        • Visualizing responses
        • Script examples
          • Assertion scripts
          • Using variables in scripts
          • Using scripts to modify request messages
          • Other examples
    • Dynamic values Modules
  • Mock API data
    • Overview
    • Smart mock
    • Custom mock
    • Mock priority sequence
    • Mock scripts
    • Cloud mock
    • Self-hosted runner mock
    • Mock language (Locales)
  • Automated tests
    • Overview
    • Test reports
    • Test scenarios
      • Create a test scenario
      • Pass data between requests
      • Flow control conditions
      • Import endpoints/endpoint cases from other projects
      • Sync data from endpoints/endpoint cases
      • Export test scenarios
    • Run test scenarios
      • Run a test scenario
      • Data-driven testing
      • Run test scenarios in batch
      • Scheduled tasks
      • Manage the runtime environment of APIs from other projects
    • Test APIs
      • Integration testing
      • Performance testing
      • End-to-end testing
      • Regression testing
    • Apidog CLI
      • Overview
      • Installing and running Apidog CLI
      • Apidog CLI Options
    • CI/CD
      • Overview
      • Integrate with Jenkins
      • Integration with Gitlab
  • Publish API Docs
    • Overview
    • API Technologies Supported
    • Quick share
    • View the API documentation
    • Publish docs sites
    • Folder tree settings
    • Custom layouts
    • Visibility settings
    • Endpoint SEO settings
    • Custom domain
    • Embedding values in document URLs
    • Documentation Search
    • Integrating Google Analytics with Doc Sites
    • CORS Proxy
    • API Versions
      • Overview
      • Create API versions
      • Publish API versions
      • Share endpoints with API versions
  • Send requests
    • Overview
    • gRPC
    • Use request proxy agents for debugging
    • SOAP/WebService
    • GraphQL
    • WebSocket
    • Socket.IO
    • SSE debugging
    • Create requests
      • Request History
      • Request basics
      • Parameters and body
      • Request headers
      • Request settings
      • HTTP/2
    • Authentication and authorization
      • Overview
      • CA and client certificates
      • Authorization types supported by Apidog
      • Digest Auth
      • OAuth 1.0
      • OAuth 2.0
      • Hawk Authentication
      • Kerberos
      • NTLM
      • Akamai EdgeGrid
    • Response and cookies
      • Overview
      • API response in Apidog
      • Create and send cookies
      • Debug requests
      • Save the request as an endpoint
  • Branches
    • Overview
    • Create a new sprint branch
    • Test APIs in a branch
    • Design API in a branch
    • Merge sprint branches
    • Manage sprint branches
  • Apidog MCP Server
    • Overview
    • Conntect API Specification within Apidog Project to AI via Apidog MCP Server
    • Conntect Online API Documentation Published by Apidog to AI via Apidog MCP Server
    • Conntect OpenAPI Files to AI via Apidog MCP Server
  • Best practices
    • How to handle API signatures
    • How to access OAuth 2.0 protected APIs
    • Apidog collaboration workflow
    • Managing authentication state in Apidog
  • Administration
    • Onboarding Checklist
      • Basic Concepts
      • Onboarding Guide
    • Managing Teams
      • Managing Teams
      • Managing Team Members
      • Member Roles & Permission Settings
      • Team Activities
      • Team Resources
        • General Runner
        • Team Variables
        • Request Proxy Agent
      • Real-time Collaborations
        • Team Collaboration
    • Managing Projects
      • Managing Projects
      • Managing Project Members
      • Notification Settings
      • Project Resources
        • Database Connection
    • Managing Organizations
      • Single Sign-On (SSO)
        • SSO Overview
        • Configure Microsoft Entra ID
        • Configure Okta
        • Configure SSO for an Organization
        • Managing user accounts
        • Mapping Groups to Teams
      • SCIM Provisioning
        • Intro to SCIM Provisioning
        • Microsoft Entra ID
        • Okta
      • Organization Resources
        • Self-hosted Runner
  • Billing
    • Overview
    • Credits
    • Unable to use credit cards?
    • Managing subscriptions
    • Upgrade plan
  • Add-ons
    • API Hub
    • Apidog Intellij IDEA plugin
    • Browser Extension
      • Chrome
      • Microsoft Edge
    • Request Proxy
      • Request proxy in Apidog web
      • Request proxy in shared docs
      • Request proxy in Apidog client
  • Account & preferences
    • Language settings
    • Data backup
    • Network proxy configuration
    • Hot keys
    • Updating Apidog
    • Generate OpenAPI access token
    • Deleting account
    • Account settings
  • References
    • API-Design First Approach
    • Apidog OpenAPI/Swagger Specificaiton Extensions
    • JSONPath
    • XPath
    • Regular Expressions
    • JSON Schema
    • CSV File Format
    • Install Java Environment
    • Runner deployment environment
    • Apidog flavored Markdown
  • Apidog Europe
    • Apidog Europe
  • Support Center
  1. Develop and Debug APIs

Generate code

Based on API spec, Apidog supports automatic generation of business code for various languages and frameworks, including but not limited to TypeScript, Java, Go, Swift, ObjectiveC, Kotlin, Dart, C++, C#, Rust and other 130 languages and frameworks.
Apidog offers three types of Code Generation: Generate Server Stubs and Client SDKs, Generate Client Code, and Generate Data Model code.
Generate Server Stubs and Client SDKs: Server Stubs are for API developers while Client SDKs are for API consumers. Produces both server-side and client-side code. Server stubs are skeletal implementations of API endpoints on the server, while Client SDKs are pre-built libraries for different programming languages to interact with the API.
Generate Client Code: For API consumers. Creates code for client applications to interact with an API.
Data Model Code: For API consumers. Generates code representations of the data structures used in the API. This includes classes or structs that define the shape of request and response objects, helping ensure type safety and consistency across the application.

Generate Server Stubs and Client SDKs#

Generate Server Stubs and Client SDKs feature in Apidog empowers developers to streamline the process of implementing APIs by automatically generating server-side code stubs and client-side SDKs based on the API specifications defined within the platform.
Server Stubs are code templates that can be used to bootstrap server-side applications, providing a foundation for implementing the specified API endpoints, request handling, and response generation. On the other hand, Client SDKs offer pre-configured code snippets for interacting with the API from the client side, simplifying the integration of API functionality into various applications.

How to generate#

1. Install the code generation plugin
Click Generate Code in API spec, and select Generate Server Stubs and Client SDKs.
Click the Download and Install button in the business code generation page.
2. Generate code
Select the desired server or client code, and click Generate Code.
3. Use custom template
You can also use the Custom Code Templates feature to generate code that conforms to your team's architectural specifications to meet a variety of individual needs.

Supported Languages/Frameworks#

LanguageServer/ClientFrameworks
JavaServerSpring, Inflector, Msf4j, Pkmst, Play Framework, Undertow Server, Vertx, Vertx Web, JAX-RS Cxf, JAX-RS Cxf Cdi, JAX-RS Cxf Extended, JAX-RS Jersey, JAX-RS Resteasy, JAX-RS Resteasy Eap, JAX-RS Spec
JavaClientAndroid, Java
PHPServerLaravel, Lumen, Symfony, Ze Ph, Slim4, Slim (Deprecated), Silex (Deprecated)
PHPClientPHP
SwiftClientSwift5, Swift4, Swift3 (Deprecated), Swift2 (Deprecated)
KotlinServerKotlin Server, Kotlin Spring, Kotlin Vertx
KotlinClientKotlin
JavaScriptClientApollo, Flowtyped, Closure Angular
Node.jsServerExpress, GraphQL Express
TypeScriptClientAxios, Fetch, Redux Query, Angular, Angularjs, Jquery, Rxjs, Node, Aurelia, Inversify
C++ServerPistache Server, Qt5 Qhttpengine Server, Restbed Server
C++ClientQt5 Client, Restsdk, Tizen
C#ServerC# Nancyfx
C#ClientC#, C# Netcore, C# Dotnet2
ASP.NETServerASP.NET Core
DartClientDart, Dart Dio, Dart Jaguar
GoServerGo Server, Go Gin Server
GoClientGo, Go (Experimental)
CClientC
Objective-CClientObjective-C
ScalaServerScala Akka Http Server, Scala Finch, Scala Lagom Server, Scala Play Server
ScalaClientScala Akka, Scala Gatling, Scala Sttp, Scalaz, Scala Httpclient (Deprecated)
ClojureClientClojure
GroovyClientGroovy
PythonServerPython Aiohttp, Python Blueplanet, Python Flask
PythonClientPython, Python (Experimental)
RustServerRust Server
RustClientRust
RubyServerRuby On Rails, Ruby Sinatra
RubyClientRuby
RClientR
PerlClientPerl
PowerShellClientPowerShell
JMeterClientJMeter
BashClientBash
LuaClientLua
F#ServerF# Functions, F# Giraffe Server
OCamlClientOCaml
ErlangServerErlang Server
ErlangClientErlang Client, Erlang Proper
FlashClientFlash
ElixirClientElixir
HaskellServerHaskell
HaskellClientHaskell Http Client
ElmClientElm
NimClientNim
AdaServerAda Server
AdaClientAda
ApexClientApex
EiffelClientEiffel
The features of Apidog's code templates are based on OpenAPI Generator but simplified. You can refer to this Youtube Video to learn more about the rules of OpenAPI generator templates.

Generate Client Code#

Client code is used to initiate API requests in various development environments. Click the Generate Client Code button on the right side of the Documentation tab in the API.
You can also generate code by clicking the code icon </> in the Run tab in the API.
Note: The Client code generated using the mentioned methods will ONLY include the API specifications and NOT the request parameter values. If you want to generate Client code that includes the request parameter values, you need to first send the request, then switch to the Actual request tab. Scroll down to find the Client code that includes the parameter values.

Supported Languages#

LanguageVariant
ShellcURL, cURL-Windows, Httpie, wget, PowerShell
JavaScriptFetch, Axios, jQuery, XHR, Native, Request , Unirest
JavaUnirest, OkHttp
SwiftURLSession
GoNative
PHPcURL, Guzzle, pecl_http, HTTP_Request2
Pythonhttp.client, Requests
HTTPHTTP
Clibcurl
C#RestSharp
Objective-CNSURLSession
RubyNet::HTTP
OCamlCohttp
Darthttp
Rhttr, RCurl

Generate data model code#

Data model code is used to define schemas, and is commonly used for serialization when APIs send data and deserialization processing when data is received. After the SQL code type is generated, you can also define table creation statements in the database table creation scenario to create data tables in the database.
To access the data model, tap the Generate Code button in the Schema Editor.
Afterward, you can select the desired programming language for the generated code and configure specific code style preferences.

Supported languages#

C#
C++
Crystal
Dart
Elm
Flow
Go
Haskell
Java
JavaScript
Kotlin
Objective-C
Pike
Python
Ruby
Rust
SQL
Swift
TypeScript

Generate Code in API Documenation#

In the API documentation generated by Apidog, you can easily generate Client Code and Data Model code. Read more about Generate Code in API Documenation.
image.png
Modified atΒ 2024-11-29 10:28:33
Previous
Design-first Mode & Request-first Mode
Next
Overview
Built with