breadcrumbDescription
Skema over eksterne tjenester - OpenAPI 3.0
Dette afsnit indeholder eksempler på Eksterne tjenester - OpenAPI 3.0-eksempler.
EditionsHeading
| Tilgængelig i: Lightning Experience |
| Tilgængelig i: Enterprise, Performance, Unlimited og Developer Edition |
Eksempel 1: Grundlæggende OpenAPI-specifikation med anmodning og svar (OAS 3.0)
Her er et eksempel på en API-specifikation, der indeholder et understøttet JSON-skema for OpenAPI 3.0. Parametrene indeholder definitionen for accountId-inputtet. Svarene indeholder definitionen af outputtet, hvilket er creditRating. Parametre, anmodninger og svar oversættes henholdsvis til inputs og outputs for dine forløbshandlinger.
{
"openapi": "3.0.0",
"info": {
"description": "A service for checking credit for an account.",
"version": "1.0.0",
"title": "Credit Decision",
"termsOfService": "http://swagger.io/terms/",
"contact": {
"email": "apiteam@swagger.io"
},
"license": {
"name": "Apache 2.0",
"url": "http://www.apache.org/licenses/LICENSE-2.0.html"
}
},
"servers": [
{
"url": "https://<YourHostName>"
}
],
"paths": {
"/account/lastCreditRating": {
"get": {
"summary": "Evaluates credit rating and decides what payment terms to offer.",
"description": "",
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/accountId"
}
},
"application/xml": {
"schema": {
"$ref": "#/components/schemas/accountId"
}
}
},
"description": "Specifies input parameters to calculate payment term",
"required": true
},
"responses": {
"200": {
"description": "success",
"content": {
"application/xml": {
"schema": {
"$ref": "#/components/schemas/creditRating"
}
},
"application/json": {
"schema": {
"$ref": "#/components/schemas/creditRating"
}
}
}
},
"405": {
"description": "Invalid input"
}
}
}
}
},
"components": {
"schemas": {
"accountId": {
"type": "object",
"properties": {
"accountIdString": {
"type": "string"
}
},
"xml": {
"name": "accountId"
}
},
"creditRating": {
"type": "object",
"properties": {
"creditRatingString": {
"type": "string"
}
},
"xml": {
"name": "creditRating"
}
}
}
}
}
Eksempel 2: Reference til navngivet objektskema (OAS 3.0)
Grundlæggende opsætning
- For de navngivne legitimationsoplysninger, som din organisation bruger til at få adgang til banksystemet, skal du tildele betegnelsen Bank og URL’en, f.eks. https://api.example.com. Brug example.com, fordi du indsætter skemaet på registreringstidspunktet i stedet for at bruge en URL til at pege på en API-specifikation.
- Registrer medarbejderbanksystemets eksterne tjeneste. Brug navnet Bank og den navngivne legitimationsoplysning Bank, og kopier og indsæt dem derefter i følgende skema.
- Banksystemets eksterne tjeneste viser to måder, hvorpå du kan definere parametre med objekttyper: en navngivet objekttype under en "komponenter/skema"-blok eller en anonymt erklæret objekttype indbygget.
Bemærk Det definerede eller afledte parameterobjekttypenavn eller en egenskab med en objekttype, skal være færre end 255 tegn, før det bruges i Apex eller Flow Builder.
Her er et skema med den navngivne objekttype defineret under "components/schema"-blokken. Telefonobjekttypens navn er ExternalService__Bank_Phone i Apex eller Flow Builder.
{
"openapi": "3.0.0",
"info": {
"title": "bankService",
"description": "API description in Markdown.",
"version": "1.0.0"
},
"servers": [
{
"url": "https://api.example.com/v1"
}
],
"components": {
"schemas": {
"User": {
"properties": {
"id": {
"type": "integer"
},
"name": {
"type": "string"
},
"phones": {
"type": "array",
"items": {
"$ref": "#/components/schemas/Phone"
}
}
}
},
"Phone": {
"properties": {
"typeofphone": {
"type": "string"
},
"phone": {
"type": "string"
}
}
}
}
}
"paths": {
"/users/{userId}": {
"get": {
"summary": "Returns a user by ID.",
"parameters": [
{
"in": "path",
"name": "userId",
"required": true,
"schema": {
"type": "integer"
}
}
],
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/User"
}
}
}
}
}
}
},
"/users": {
"post": {
"summary": "Creates a new user.",
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/User"
}
}
}
},
"responses": {
"200": {
"description": "OK"
}
}
}
}
}
}
Eksempel 3: Indbygget anonymt objektskema (OAS 3.0)
Her er en API-specifikation med et JSON-skema med anonyme objekttyper defineret direkte. Den afledte telefonobjekttypes navn er ExternalService__Bank_getUsers_OUT_200_phones.
{
"openapi": "3.0.0",
"info": {
"title": "bankService",
"description": "API description in Markdown.",
"version": "1.0.0"
},
"servers": [
{
"url": "https://api.example.com/v1"
}
],
"paths": {
"/users/{userId}": {
"get": {
"summary": "Returns a user by ID.",
"parameters": [
{
"in": "path",
"name": "userId",
"required": true,
"schema": {
"type": "integer"
}
}
],
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"id": {
"type": "integer"
},
"name": {
"type": "string"
},
"phones": {
"type": "array",
"items": {
"type": "object",
"properties": {
"typeofphone": {
"type": "string"
},
"phone": {
"type": "string"
}
}
}
}
}
}
}
}
}
}
}
},
"/users": {
"post": {
"summary": "Creates a new user.",
"requestBody": {
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"id": {
"type": "integer"
},
"name": {
"type": "string"
},
"phones": {
"type": "array",
"items": {
"type": "object",
"properties": {
"typeofphone": {
"type": "string"
},
"phone": {
"type": "string"
}
}
}
}
}
}
}
}
},
"responses": {
"200": {
"description": "OK"
}
}
}
}
}
}
Eksempel 4: Apex (OAS 3.0)
Her er en API-specifikation med det eksterne tjenestenavn BankingAutomaticTellerMachine: De afledte objektnavne skal dog være på færre end 255 tegn.
-
ExternalService__BankingAutomaticTellerMachine_VeryImportantCustomer_phone -
ExternalService__BankingAutomaticTellerMachine_getBalanceAccountTypeChecking_OUT_200
Hvis du vil bruge Apex eller Flow Builder, skal du afkorte navnet på den eksterne tjeneste og skemaet (vis i eksempel 5).
- Forkort navnet på den eksterne tjeneste.
- Hvis objektet er erklæret indbygget under et handlingsparamter, kan du forkorte handlingsnavnet ved at føje et handlings-id til skemaet.
- Hvis objektet erklæres indbygget under en overordnet objektegenskab, kan du forkorte det overordnede objektnavn i skemaet
- Erklær det indlejrede objekt som et topniveauobjekt under skemaet "components/schemas".
{
"openapi": "3.0.0",
...
"paths": {
"/balance/account/{accountId}/type/checking": {
"get": {
"parameters": [
{
"in": "path",
"name": "accountId",
"required": true,
"schema": {
"type": "integer"
}
}
],
"responses": {
"200": {
"description": "",
"content": {
"*/*": {
"schema": {
"type": "object",
"properties": {
"balance": {
"type": "integer"
},
"owner": {
"$ref": "#/components/schemas/VeryImportantCustomer"
}
}
}
}
}
}
}
}
}
},
"components": {
"schemas": {
"VeryImportantCustomer": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"phone": {
"type": "object",
"properties": {
"number": {
"type": "string"
}
}
}
}
}
}
}
}
Eksempel 5: Afkortning af Apex (OAS 3.0)
Her er et eksempel på en API-specifikation, der resulterer i afkortede navne. Den er registreret med det afkortede navn BankAtm.
Afkort navnet på skemaet for den eksterne tjeneste til BankAtm, skemaobjektnavnet til VIP, og tilføj operationId som getBalance:
-
ExternalService__BankAtm_VIP_phone -
ExternalService__BankAtm_getBalance_200
{
"openapi": "3.0.0",
...
"paths": {
"/balance/account/{accountId}/type/checking": {
"get": {
"operationId": "getBalance",
"parameters": [
{
"in": "path",
"name": "accountId",
"required": true,
"schema": {
"type": "integer"
}
}
],
"responses": {
"200": {
"description": "",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"balance": {
"type": "integer"
},
"owner": {
"$ref": "#/components/schemas/VIP"
}
}
}
}
}
}
}
}
}
},
"components": {
"schemas": {
"VIP": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"phone": {
"type": "object",
"properties": {
"number": {
"type": "string"
}
}
}
}
}
}
}
}
Eksempel 6: Indbyggede matrikser (OAS 3.0)
Her er et eksempel med en indbygget matriksdefinition.
{
"openapi": "3.0.0",
...
"paths": {
"/employees/{employeeId}": {
"get": {
"operationId": "getEmployee",
"parameters": [
{
"in": "path",
"name": "employeeId",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"employee": {
"$ref": "#/components/schemas/Employee"
},
"manager": {
"$ref": "#/components/schemas/Employee"
},
"team": {
"type": "array",
"items": {
"$ref": "#/components/schemas/Employee"
}
}
}
}
}
}
}
}
}
}
},
"components": {
"schemas": {
"Employee": {
"type": "object",
"properties": {
"employeeId": {"type": "string"},
"firstName": {"type": "string"},
"middleName": {"type": "string"},
"lastName": {"type": "string"},
"dateOfHire": {"type": "date"}
}
}
}
}
}
Eksempel 7: HTTP-sidehovedparametre (OAS 3.0)
Her kan du se, hvordan en sidehovedparameter erklæres i et OpenAPI-skema. I Apex eller Flow vises navnet "apiKey" som en strengparameter. Når du nu angiver en vilkårlig strengværdi i Apex eller et forløb til apiKey, fungerer den som en HTTP-parameter, når der foretages en udkaldsanmodning.
{
"openapi": "3.0.0",
"info": {
"description": "A service for checking credit for an account.",
"version": "1.0.0",
"title": "Credit Decision",
"termsOfService": "http://swagger.io/terms/",
"contact": {
"email": "apiteam@swagger.io"
},
"license": {
"name": "Apache 2.0",
"url": "http://www.apache.org/licenses/LICENSE-2.0.html"
}
},
"servers": [
{
"url": "https://<YourHostName>"
}
],
"paths": {
"/account/lastCreditRating": {
"get": {
"summary": "Evaluates credit rating and decides what payment terms to offer.",
"description": "",
"parameters": [
{
"name": "apiKey",
"description": "Your API Key for calling the credit rating service",
"in": "header",
"schema": {
"type": "string"
}
}
],
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/accountId"
}
},
"application/xml": {
"schema": {
"$ref": "#/components/schemas/accountId"
}
}
},
"description": "Specifies input parameters to calculate payment term",
"required": true
},
"responses": {
"200": {
"description": "success",
"content": {
"application/xml": {
"schema": {
"$ref": "#/components/schemas/creditRating"
}
},
"application/json": {
"schema": {
"$ref": "#/components/schemas/creditRating"
}
}
}
},
"405": {
"description": "Invalid input"
}
}
}
}
},
"components": {
"schemas": {
"accountId": {
"type": "object",
"properties": {
"accountIdString": {
"type": "string"
}
},
"xml": {
"name": "accountId"
}
},
"creditRating": {
"type": "object",
"properties": {
"creditRatingString": {
"type": "string"
}
},
"xml": {
"name": "creditRating"
}
}
}
}
}
Eksempel 8: URL-kodet formularmedietype (OAS 3.0)
Anmodnings- og svarformulardata erklæres med medietypen application/x-www-form-urlencoded.
{
"openapi": "3.0.0",
"info": {
"description": "Apply here for your next mortgage",
"version": "1.0.0",
"title": "My Mortgage Buddy",
"contact": {
"email": "apiteam@swagger.io"
}
},
"servers": [
{
"url": "https://MyMortgageBuddy.org/mortgages"
}
],
"paths": {
"/apply": {
"post": {
"operationId": "applyMortgage",
"requestBody": {
"content": {
"application/x-www-form-urlencoded; charset=utf-8": {
"schema": {
"type": "object",
"properties": {
"terms": {
"description": "Desired mortgage terms",
"type": "array",
"items": {
"type": "integer"
}
},
"fullName": {
"description": "Full Name",
"type": "string"
},
"loanAmount": {
"description": "Loan amount",
"type": "number"
}
},
"required": [
"terms",
"fullName",
"loanAmount"
]
}
}
}
},
"responses": {
"200": {
"description": "200",
"content": {
"application/x-www-form-urlencoded; charset=utf-8": {
"schema": {
"type": "object",
"properties": {
"formApplicationId": {
"type": "string"
},
"loanOfficerFullName": {
"type": "string"
}
}
}
}
}
}
}
}
}
}
}
Eksempel 9: allOf and additionalProperties Schema Directives (OAS 3.0)
Denne JSON-skema definition fremhæver konstruktørerne allOf for skemaobjektkomposition og additionalProperties for ordbogsværdier. Eksempelskemaet er registreret som ekstern tjeneste MyBank med navngivne legitimationsoplysninger MyBank.
Skemaet definerer en banktjeneste, der henter kundedetaljer for et kunde-id.
Customerskemaobjektet har ordbogsegenskaber af typen skemaobjektCreditRating. I Apex har klasseExternalService.MyBank_Customerpropertiesaf typenMap<String, ExternalService_CreditRating>med kundens kreditvurdering.PhonesogEmailsopretter deres egne egenskaber sammen med fællesallOf-egenskaber fra skemaobjektetContact.
{
"openapi": "3.0.0",
"info": {
"title": "myBank",
"description": "Sample Banking Service with allOf and additionalProperties",
"version": "1.0.0"
},
"servers": [
{
"url": "https://api.mybank.com/v1"
}
],
"paths": {
"/customers/{customerId}": {
"get": {
"summary": "Get the customer by ID.",
"parameters": [
{
"in": "path",
"name": "customerId",
"required": true,
"schema": {
"type": "integer"
}
}
],
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Customer"
}
}
}
}
}
}
}
},
"components": {
"schemas": {
"Customer": {
"type": "object",
"properties": {
"id": {
"type": "integer"
},
"name": {
"type": "string"
},
"phones": {
"type": "array",
"items": {
"$ref": "#/components/schemas/Phone"
}
},
"emails": {
"type": "array",
"items": {
"$ref": "#/components/schemas/Email"
}
}
},
"additionalProperties": {
"$ref": "#/components/schemas/CreditRating"
},
"required": [
"id",
"name"
]
},
"Contact": {
"type": "object",
"properties": {
"primary": {
"type": "boolean"
},
"timeOfDay": {
"type": "string"
}
},
"required": [
"primary"
]
},
"Phone": {
"allOf": [
{
"$ref": "#/components/schemas/Contact"
},
{
"type": "object",
"properties": {
"typeOfPhone": {
"type": "string"
},
"phoneNumber": {
"type": "string"
}
}
}
]
},
"Email": {
"allOf": [
{
"$ref": "#/components/schemas/Contact"
},
{
"type": "object",
"properties": {
"email": {
"type": "string"
}
}
}
]
},
"CreditRating": {
"type": "object",
"properties": {
"rating": {
"type": "string"
},
"score": {
"type": "number",
"format": "double"
}
}
}
}
}
}
Hvis du vil bruge allOf sammensætning og additionalProperties, kan du se Eksempler 9: allOf Composition og additionalProperties Use in Flow with Apex Unit Tests.
Eksempel 10: allOf- og Discriminator-direktiver (OAS 3.0)
Hvis du vil angive en generel liste over kontakter, der kan udvides, for en kunde, kan discriminator-direktivet kombineres med allOf for at erklære, at en kontakt er en mail eller et telefonnummer:
{
"openapi": "3.0.0",
"info": {
"title": "myBank",
"description": "Sample Banking Service with allOf and discriminator",
"version": "1.0.0"
},
"servers": [
{
"url": "https://api.mybank.com/v1"
}
],
"paths": {
"/customers/{customerId}": {
"get": {
"summary": "Get the customer by ID.",
"parameters": [
{
"in": "path",
"name": "customerId",
"required": true,
"schema": {
"type": "integer"
}
}
],
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Customer"
}
}
}
}
}
}
}
},
"components": {
"schemas": {
"Customer": {
"type": "object",
"properties": {
"id": {
"type": "integer"
},
"name": {
"type": "string"
},
"contacts": {
"type": "array",
"items": {
"$ref": "#/components/schemas/Contact"
}
}
},
"required": [
"id",
"name"
]
},
"Contact": {
"type": "object",
"discriminator": {
"propertyName": "contactType"
},
"properties": {
"contactType": {
"type": "string"
},
"primary": {
"type": "boolean"
},
"timeOfDay": {
"type": "string"
}
},
"required": [
"contactType",
"primary"
]
},
"Phone": {
"allOf": [
{
"$ref": "#/components/schemas/Contact"
},
{
"type": "object",
"properties": {
"typeOfPhone": {
"type": "string"
},
"phoneNumber": {
"type": "string"
}
}
}
]
},
"Email": {
"allOf": [
{
"$ref": "#/components/schemas/Contact"
},
{
"type": "object",
"properties": {
"email": {
"type": "string"
}
}
}
]
}
}
}
}
Hvis du vil bruge sammensætning og polymorfe OpenAPI-skemakonstruktioner, kan du se Eksempler 10: Polymorphism med allOf og Discriminator.
Eksempel 11: anyOf-, oneOf- og diskriminatordirektiver (OAS 3.0)
anyOf og oneOf modeller med dele af en fælles skematype. anyOf og oneOf kan kombineres med skemakonstruktions discriminator for polymorfiske typer.
- Socialt sikkerhedsnummer
- Kørekort
- Kundens for- og efternavn med valgfrit mellemnavn
I eksemplet kan en kunde identificeres af en eller flere af følgende tilladte identifikatorer:
Skemaet kræver både kundens for- og efternavn eller at vælge enhver anden tilladt identifikation.
Dette eksempel fremhæver også en variation af kontakttypen polymorfisme med oneOf og discriminator fra Eksempel 10 med allOf.
{
"openapi": "3.0.0",
"info": {
"title": "myBank",
"description": "Sample Banking Service with oneOf, anyOf and discriminator",
"version": "1.0.0"
},
"servers": [
{
"url": "https://api.mybank.com/v1"
}
],
"paths": {
"/customers/{customerId}": {
"get": {
"summary": "Get the customer by ID.",
"parameters": [
{
"in": "path",
"name": "customerId",
"required": true,
"schema": {
"type": "integer"
}
}
],
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Customer"
}
}
}
}
}
}
}
},
"components": {
"schemas": {
"Customer": {
"type": "object",
"properties": {
"id": {
"anyOf": [
{
"$ref": "#/components/schemas/SSN"
},
{
"$ref": "#/components/schemas/DriversLicense"
},
{
"$ref": "#/components/schemas/FullName"
}
]
},
"contacts": {
"type": "array",
"items": {
"$ref": "#/components/schemas/Contact"
}
}
},
"required": [
"id"
]
},
"SSN": {
"type": "object",
"properties": {
"ssn": {
"type": "string"
}
},
"required": [
"ssn"
]
},
"DriversLicense": {
"type": "object",
"properties": {
"dl": {
"type": "string"
}
},
"required": [
"dl"
]
},
"FullName": {
"type": "object",
"properties": {
"firstName": {
"type": "string"
},
"middleName": {
"type": "string"
},
"lastName": {
"type": "string"
}
},
"required": [
"firstName",
"lastName"
]
},
"Contact": {
"oneOf": [
{
"$ref": "#/components/schemas/Phone"
},
{
"$ref": "#/components/schemas/Email"
}
],
"discriminator": {
"propertyName": "contactType"
}
},
"Phone": {
"type": "object",
"properties": {
"contactType": {
"type": "string"
},
"typeOfPhone": {
"type": "string"
},
"phoneNumber": {
"type": "string"
}
}
},
"Email": {
"type": "object",
"properties": {
"contactType": {
"type": "string"
},
"email": {
"type": "string"
}
}
}
}
}
}
Hvis du vil bruge sammensætnings- og polymorfe OpenAPI-skemakonstruktioner, kan du se Eksempel 11 (Open API 3.0): AnyOf, OneOf og diskriminator.
Eksempel 12: Tilbagekald (OAS3.0)
Eksterne tjenester angiver tilbagekaldsindstillinger gennem OpenAPI 3.0-skemaets callbacks.
Dette er et eksempel på et tilbagekald for en ansøgningsproces for realkreditlån for det fiktive firma Acme Mortgages.
openapi: 3.0.0
info:
version: '1.0'
title: Acme Mortgages
description: Acme Mortgages
paths:
# Example of synchronous operation GetApplication
/applications/{applicationNumber}:
get:
operationId: GetApplication
description: Get the mortgage application status and details
parameters:
- name: applicationNumber
in: path
required: true
description: Mortgage Application Number
schema:
type: string
- name: referenceId
in: query
description: Reference ID if applicable. Either as query or header
schema:
type: string
- name: referenceId
in: header
description: Reference ID if applicable. Either as query or header
schema:
type: string
responses:
200:
description: Mortgage application status
content:
application/json:
schema:
$ref: '#/components/schemas/MortgageApplication'
/applications:
# Example of asynchronous operation with callback SubmitApplication
post:
operationId: SubmitApplication
description: Submit a new mortgage application
requestBody:
content:
application/json:
schema:
type: object
properties:
applicant:
$ref: '#/components/schemas/Contact'
object:
$ref: '#/components/schemas/Contact'
statusUpdateRequest:
$ref: '#/components/schemas/ApplicationStatusUpdateRequest'
callbackUrl:
type: object
properties:
outcome:
type: object
properties:
approved:
type: string
rejected:
type: string
documentation:
type: string
outcomeError:
type: string
responses:
200:
description: Mortgage loan application submission response
content:
application/json:
schema:
type: object
properties:
applicationNumber:
type: string
400:
description: Mortgage application error
content:
application/json:
schema:
$ref: '#/components/schemas/MortgageApplicationError'
callbacks:
applicationOutcome:
'{$request.body#/callbackUrl/outcome/approved}':
post:
operationId: ApplicationApproved
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/MortgageApplication'
responses:
200:
description: Approved mortgage application callback accepted
'{$request.body#/callbackUrl/outcome/rejected}':
post:
operationId: ApplicationRejected
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/MortgageApplication'
responses:
200:
description: Rejected mortgage application callback accepted
applicationDocumentation:
'{$request.body#/callbackUrl/documentation}':
post:
parameters:
- in: query
name: applicationNumber
schema:
type: string
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/MortgageApplicationDocumentation'
responses:
200:
description: Mortgage application documentation callback accepted
applicationStatus_Update:
$ref: '#/components/callbacks/ApplicationStatus_Update'
applicationOutcomeError:
$ref: '#/components/callbacks/applicationOutcomeError'
servers:
- url: '/'
components:
schemas:
MortgageApplication:
required:
- applicationNumber
- status
properties:
applicationNumber:
type: string
status:
description: One of pending, approved, rejected
type: string
requestedAmount:
type: number
approvedAmount:
type: number
appliedOn:
type: string
format: date-time
updatedOn:
type: string
format: date-time
applicant:
$ref: '#/components/schemas/Contact'
object:
$ref: '#/components/schemas/Contact'
ApplicationStatusUpdateRequest:
description: Mortgage application status update request
type: object
properties:
sendStatusUpdates:
type: boolean
statusUpdateCallbackUrl:
type: string
MortgageApplicationDocumentation:
description: Required mortgage documentation
type: array
items:
type: object
properties:
documentType:
type: string
uploadUrl:
type: string
instructions:
type: string
Contact:
type: object
properties:
name:
type: string
address:
type: string
MortgageApplicationError:
properties:
errorMessage:
type: string
applicationNumber:
type: string
callbacks:
ApplicationStatus_Update:
'{$request.body#/statusUpdateRequest/statusUpdateCallbackUrl}':
post:
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
applicationNumber:
type: string
status:
type: string
updateMessage:
type: string
responses:
200:
description: Mortgage application status update callback accepted
applicationOutcomeError:
'{$request.body#/callbackUrl/outcomeError}':
post:
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/MortgageApplicationError'
responses:
200:
description: Mortgage application callback error acceptedEksempel 13: Filupload og -download (OAS 3.0)
Denne specifikation indeholder disse eksempler:
- En PUT-handling for filupload – PUT-handlingen tager en
key-parameter med placeringen/filnavnet på den fil, der skal uploades og angivercontent-type-sidehovedet.requestBodyer defineret som en binær streng og indeholder indholdet af den fil, der uploades. - En GET-handling for fildownload – GET-handlingen tager en
key-parameter med filnavnet på den fil, der skal downloades. Svaret 200 returnerer etcontentobjekt defineret som en binær streng og indeholder indholdet af den fil, der downloades.
Denne specifikation refererer til upload af en fil til Amazon S3, men specifikationen kan bruges til at uploade filer til ethvert system, som du har konfigureret en navngivet legitimationsoplysning for.
openapi: 3.0.0
info:
title: S3 PutObject and GetObject API
version: 1.1.0
description: Example API for uploading and downloading files to Amazon S3 (without auth headers)
paths:
/{key}:
put:
summary: Upload an object to S3 at the specified key
description: Upload a file to the given bucket and key using HTTP PUT.
operationId: putObject
parameters:
- name: key
in: path
required: true
description: The key (path) of the S3 object
schema:
type: string
- name: Content-Type
in: header
description: MIME type of the uploaded file
schema:
type: string
requestBody:
required: true
content:
application/octet-stream:
schema:
type: string
format: binary
description: Binary content of the file to upload
responses:
'200':
description: Upload successful
headers:
ETag:
description: The ETag of the uploaded object
schema:
type: string
'400':
description: Bad request
'404':
description: Bucket or key not found
'500':
description: Internal server error
get:
summary: Download an object from S3 at the specified key
description: Download the file content from the given bucket and key using HTTP GET.
operationId: getObject
parameters:
- name: key
in: path
required: true
description: The key (path) of the S3 object
schema:
type: string
responses:
'200':
description: File content returned
content:
application/octet-stream:
schema:
type: string
format: binary
'403':
description: Access denied
'404':
description: Object not found
'500':
description: Internal server error
Hvis du vil bruge denne funktionalitet, kan du se Eksempel 13 (Open API 3.0): Binær filupload og For eksempel 13 (Open API 3.0): Binær fil Download.
Eksempel 14: Angiv parametre i forespørgsler og svar (OAS 3.0)
Denne specifikation indeholder en GET-handling, der tager to opslagsværdier som parametre:
- En
ItemStatus-parameter, der indeholder en værdi fra ItemStatus-nummeret. - En
ItemPriority-parameter, der indeholder en værdi fra ItemPriority-nummeret.
200-svaret returnerer et objekt, der indeholder element-id'et, status, prioritet og beskrivelse.
{
"openapi": "3.0.3",
"info": {
"title": "Enum Examples API",
"version": "1.0.0",
"description": "Example API demonstrating enum parameters in queries and responses."
},
"servers": [
{
"url": "https://abc-mock-api-123456789123.herokuapp.com/"
}
],
"paths": {
"/items": {
"get": {
"operationId": "getItemList",
"summary": "Retrieve a list of items filtered by enum parameters",
"parameters": [
{
"name": "status",
"in": "query",
"required": true,
"schema": {
"$ref": "#/components/schemas/ItemStatus"
},
"description": "Filter items by their status"
},
{
"name": "priority",
"in": "query",
"required": false,
"schema": {
"$ref": "#/components/schemas/ItemPriority"
},
"description": "Optional filter for item priority"
}
],
"responses": {
"200": {
"description": "Successful response with list of items",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ItemResponse"
}
}
}
}
}
}
}
},
"components": {
"schemas": {
"ItemStatus": {
"type": "string",
"enum": [
"active",
"inactive",
"pending",
"archived"
]
},
"ItemPriority": {
"type": "integer",
"enum": [
1,
2,
3,
4,
5
]
},
"ItemResponse": {
"type": "object",
"properties": {
"id": {
"type": "integer",
"format": "int64"
},
"status": {
"$ref": "#/components/schemas/ItemStatus"
},
"priority": {
"$ref": "#/components/schemas/ItemPriority"
},
"message": {
"type": "string",
"description": "Additional information about the item"
}
},
"required": [
"id",
"status"
]
}
}
}
}
Eksempel 15: Enhver type understøttelse ved brug af skemaet: {} (OAS 3.0)
Denne specifikation indeholder en POST-metode, der tager enhver JSON-streng. Enhver type support er kun tilgængelig for organisationer, der har Data 360 klargjort.
Du kan også bruge en blandet struktur i din specifikation, der kombinerer indtastede parametre med en brødtekst af enhver type. Definer f.eks. typede forespørgselsparametre, stiparametre eller sidehoveder for begivenhedsmetadata, mens du bevarer anmodningens brødtekst som enhver type.
openapi: 3.0.1
info:
title: Flow Any Type Test Service
description: |
Minimal OAS3 spec for any type support
version: 1.0.0
servers:
- url: https://sample.com
paths:
/test:
post:
operationId: sendTestPayload
summary: Accepts any JSON payload (anytype body)
requestBody:
required: false
content:
application/json:
schema: {}
responses:
'200':
description: Payload accepted
content:
application/json:
schema:
type: object
properties:
status:
type: string
example: ok
