You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
spiderman/docs/swagger.yaml

469 lines
12 KiB

basePath: /api/v1
definitions:
models.Asset:
properties:
ID:
example: asset123
type: string
appraisedValue:
example: "2000"
type: string
color:
example: red
type: string
owner:
example: Alice
type: string
size:
example: "10"
type: string
type: object
models.BlockHeightResponse:
properties:
height:
example: 12345
type: integer
type: object
models.ChainInfoResponse:
properties:
blockHash:
example: a1b2c3d4e5f6...
type: string
chainName:
example: mychannel
type: string
height:
example: 12345
type: integer
type: object
models.CreateAssetRequest:
properties:
appraisedValue:
example: "2000"
type: string
color:
example: red
type: string
id:
description: Optional - will be auto-generated if not provided
example: asset123
type: string
owner:
example: Alice
type: string
size:
example: "10"
type: string
type: object
models.ErrorResponse:
properties:
message:
type: string
success:
type: boolean
type: object
models.HealthResponse:
properties:
status:
example: healthy
type: string
type: object
models.Response:
properties:
data: {}
message:
type: string
success:
type: boolean
type: object
models.TransactionDetail:
properties:
arguments:
example:
- asset1
- red
- "10"
- Alice
- "1000"
items:
type: string
type: array
blockHash:
example: a1b2c3d4e5f6...
type: string
blockNumber:
example: 123
type: integer
chaincodeId:
example: basic
type: string
channelId:
example: mychannel
type: string
creatorId:
example: User1@org1.example.com
type: string
creatorMspId:
example: Org1MSP
type: string
endorsers:
example:
- peer0.org1.example.com
- peer0.org2.example.com
items:
type: string
type: array
function:
example: CreateAsset
type: string
rawTransaction:
additionalProperties: true
type: object
response:
$ref: '#/definitions/models.TransactionResponse'
timestamp:
example: "2024-01-15T10:30:00Z"
type: string
transactionId:
example: f973e40540e3b629b7dffd0b91b87aa3474bc31de89e11b01f749bbc5e6d5add
type: string
validationCode:
example: VALID
type: string
type: object
models.TransactionResponse:
properties:
message:
example: Transaction completed successfully
type: string
payload:
example: ""
type: string
status:
example: 200
type: integer
type: object
models.TransferAssetRequest:
properties:
newOwner:
example: Bob
type: string
type: object
host: localhost:8888
info:
contact:
email: support@swagger.io
name: API Support
url: http://www.swagger.io/support
description: RESTful API for managing assets on Hyperledger Fabric blockchain
license:
name: Apache 2.0
url: http://www.apache.org/licenses/LICENSE-2.0.html
termsOfService: http://swagger.io/terms/
title: Hyperledger Fabric Asset Transfer API
version: "1.0"
paths:
/assets:
get:
consumes:
- application/json
description: Retrieve all assets from the blockchain ledger
produces:
- application/json
responses:
"200":
description: OK
schema:
allOf:
- $ref: '#/definitions/models.Response'
- properties:
data:
items:
$ref: '#/definitions/models.Asset'
type: array
type: object
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/models.ErrorResponse'
summary: Get all assets
tags:
- assets
post:
consumes:
- application/json
description: Create a new asset on the blockchain ledger with auto-generated
UUID if ID not provided
parameters:
- description: Asset data (ID is optional and will be auto-generated)
in: body
name: asset
required: true
schema:
$ref: '#/definitions/models.CreateAssetRequest'
produces:
- application/json
responses:
"201":
description: Created
schema:
allOf:
- $ref: '#/definitions/models.Response'
- properties:
data:
properties:
asset:
$ref: '#/definitions/models.Asset'
transactionId:
type: string
type: object
type: object
"400":
description: Bad Request
schema:
$ref: '#/definitions/models.ErrorResponse'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/models.ErrorResponse'
summary: Create a new asset
tags:
- assets
/assets/{id}:
get:
consumes:
- application/json
description: Retrieve a specific asset by its ID from the blockchain ledger
parameters:
- description: Asset ID
in: path
name: id
required: true
type: string
produces:
- application/json
responses:
"200":
description: OK
schema:
allOf:
- $ref: '#/definitions/models.Response'
- properties:
data:
$ref: '#/definitions/models.Asset'
type: object
"404":
description: Not Found
schema:
$ref: '#/definitions/models.ErrorResponse'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/models.ErrorResponse'
summary: Get asset by ID
tags:
- assets
put:
consumes:
- application/json
description: Update an existing asset's information on the blockchain
parameters:
- description: Asset ID
in: path
name: id
required: true
type: string
- description: Updated asset data
in: body
name: asset
required: true
schema:
$ref: '#/definitions/models.CreateAssetRequest'
produces:
- application/json
responses:
"200":
description: OK
schema:
allOf:
- $ref: '#/definitions/models.Response'
- properties:
data:
$ref: '#/definitions/models.Asset'
type: object
"400":
description: Bad Request
schema:
$ref: '#/definitions/models.ErrorResponse'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/models.ErrorResponse'
summary: Update an existing asset
tags:
- assets
/assets/{id}/transfer:
put:
consumes:
- application/json
description: Transfer ownership of an asset to a new owner
parameters:
- description: Asset ID
in: path
name: id
required: true
type: string
- description: Transfer request
in: body
name: request
required: true
schema:
$ref: '#/definitions/models.TransferAssetRequest'
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/models.Response'
"400":
description: Bad Request
schema:
$ref: '#/definitions/models.ErrorResponse'
"404":
description: Not Found
schema:
$ref: '#/definitions/models.ErrorResponse'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/models.ErrorResponse'
summary: Transfer asset ownership
tags:
- assets
/blockchain/height:
get:
consumes:
- application/json
description: Get the current block height of the blockchain
produces:
- application/json
responses:
"200":
description: OK
schema:
allOf:
- $ref: '#/definitions/models.Response'
- properties:
data:
$ref: '#/definitions/models.BlockHeightResponse'
type: object
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/models.ErrorResponse'
summary: Get block height
tags:
- blockchain
/blockchain/info:
get:
consumes:
- application/json
description: Get detailed information about the blockchain including block height
produces:
- application/json
responses:
"200":
description: OK
schema:
allOf:
- $ref: '#/definitions/models.Response'
- properties:
data:
$ref: '#/definitions/models.ChainInfoResponse'
type: object
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/models.ErrorResponse'
summary: Get chain information
tags:
- blockchain
/health:
get:
consumes:
- application/json
description: Check the health status of the API
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/models.HealthResponse'
summary: Health check
tags:
- health
/ledger/init:
post:
consumes:
- application/json
description: Initialize the blockchain ledger with a set of assets
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/models.Response'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/models.ErrorResponse'
summary: Initialize ledger
tags:
- ledger
/transactions/{txid}:
get:
consumes:
- application/json
description: Retrieve detailed information about a specific transaction by its
ID
parameters:
- description: Transaction ID
in: path
name: txid
required: true
type: string
produces:
- application/json
responses:
"200":
description: OK
schema:
allOf:
- $ref: '#/definitions/models.Response'
- properties:
data:
$ref: '#/definitions/models.TransactionDetail'
type: object
"400":
description: Bad Request
schema:
$ref: '#/definitions/models.ErrorResponse'
"404":
description: Not Found
schema:
$ref: '#/definitions/models.ErrorResponse'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/models.ErrorResponse'
summary: Get transaction details by ID
tags:
- transactions
schemes:
- http
- https
swagger: "2.0"