Marketplace Service API (1.0.0)

Download OpenAPI specification:Download

License: Apache 2.0

Defines resources and methods for offering and bidding physical servers in a Marketplace

offer

Operations about selling servers

show me offers from everyone

Obtain list of offers from everyone. If admin is making this request, show all offers with all statuses. In case of a non-admin user show offers with status 'available' only.

Responses

200

successful operation

get /offer

SwaggerHub API Auto Mocking

https://virtserver.swaggerhub.com/FLOCX/Marketplace_service/1.0.0/offer

SwaggerHub API Auto Mocking

https://virtserver.swaggerhub.com/FLOCX/Marketplace_Service/1.0.0/offer

Response samples

Content type
application/json
Copy
Expand all Collapse all
[
  • {
    }
]

Create a new offer

Adds attributes , , <Status = available> to the incoming offer

Request Body schema: application/json

offer to be published.

provider_offer_id
string <UUID>
provider_id
string <UUID>
project_id
string <UUID>

project that created the offer

server_id
string <UUID>

unique ID of the physical server

start_time
string <(yyyy-mm-ddThh:mm:ss-/+hh)>

ISO-8601 DateTime format with timezone difference from UTC eg '(Date-16 July 2016, Time 8-30 pm Boston time)'

end_time
string <(yyyy-mm-ddThh:mm:ss-/+hh)>

ISO-8601 DateTime format with timezone difference from UTC eg '(Date-16 August 2016, Time 8-30 pm Boston time)'

server_config
object (Server_config)
cost
number <float64>

States floor price, the minimum asking price. Rate is charged per hour.

Responses

201

Offer added to marketplace successfully.

400

Invalid input data.

post /offer

SwaggerHub API Auto Mocking

https://virtserver.swaggerhub.com/FLOCX/Marketplace_service/1.0.0/offer

SwaggerHub API Auto Mocking

https://virtserver.swaggerhub.com/FLOCX/Marketplace_Service/1.0.0/offer

Request samples

Content type
application/json
Copy
Expand all Collapse all
{
  • "provider_offer_id": "90894712-3b21-4bf7-9899-b4234530ff8b",
  • "provider_id": "90894712-3b21-4bf7-9899-b4219730ff8b",
  • "project_id": "12a59a51-b4d6-497d-9f75-f56c409305c8",
  • "server_id": "fb878e3e-9425-4285-babf-0e58a7b091b2",
  • "start_time": "(2016-07-16T19:20:30-04:00)",
  • "end_time": "(2016-08-16T19:20:30-04:00)",
  • "server_config":
    {
    },
  • "cost": 11
}

Response samples

Content type
application/json
Copy
Expand all Collapse all
{
  • "marketplace_offer_id": "b711b1ca-a77e-4392-a9b5-dc84c4f469ac",
  • "provider_offer_id": "90894712-3b21-4bf7-9899-b4234530ff8b",
  • "provider_id": "b9752cc0-9bed-4f1c-8917-12ade7a6fdbe",
  • "project_id": "12a59a51-b4d6-497d-9f75-f56c409305c8",
  • "marketplace_date_created": "(2016-07-16T19:20:30-04:00)",
  • "status": "available",
  • "server_id": "fb878e3e-9425-4285-babf-0e58a7b091b2",
  • "start_time": "(2016-07-16T19:20:30-04:00)",
  • "end_time": "(2016-08-16T19:20:30-04:00)",
  • "server_config":
    {
    },
  • "cost": 11
}

Show me details of a particular offer.

Admin can query any offer by its offer_id. Non-admin user can query any 'available' offer and any offer that she herself created.

Responses

200

Succesful operation.

400

Invalid .

403

You do not have sufficient privileges to access this resource! Will occur when an non-admin user is trying to access an offer created by other user and the status of the offer is anything else except 'available'

404

does not exist.

get /offer/<offer_id>

SwaggerHub API Auto Mocking

https://virtserver.swaggerhub.com/FLOCX/Marketplace_service/1.0.0/offer/<offer_id>

SwaggerHub API Auto Mocking

https://virtserver.swaggerhub.com/FLOCX/Marketplace_Service/1.0.0/offer/<offer_id>

Response samples

Content type
application/json
Copy
Expand all Collapse all
{
  • "marketplace_offer_id": "b711b1ca-a77e-4392-a9b5-dc84c4f469ac",
  • "provider_offer_id": "90894712-3b21-4bf7-9899-b4234530ff8b",
  • "provider_id": "b9752cc0-9bed-4f1c-8917-12ade7a6fdbe",
  • "project_id": "12a59a51-b4d6-497d-9f75-f56c409305c8",
  • "marketplace_date_created": "(2016-07-16T19:20:30-04:00)",
  • "status": "available",
  • "server_id": "fb878e3e-9425-4285-babf-0e58a7b091b2",
  • "start_time": "(2016-07-16T19:20:30-04:00)",
  • "end_time": "(2016-08-16T19:20:30-04:00)",
  • "server_config":
    {
    },
  • "cost": 11
}

Deletes the offer.

Sets the status field of the offer to "cancelled"

Responses

200

Offer cancelled successfully

400

Invalid .

403

You do not have sufficient privileges to execute this operation. Non-admin or non-owner user cannot update the status field of the offer.

404

does not exist.

delete /offer/<offer_id>

SwaggerHub API Auto Mocking

https://virtserver.swaggerhub.com/FLOCX/Marketplace_service/1.0.0/offer/<offer_id>

SwaggerHub API Auto Mocking

https://virtserver.swaggerhub.com/FLOCX/Marketplace_Service/1.0.0/offer/<offer_id>

Response samples

Content type
application/json
Copy
Expand all Collapse all
{
  • "status": "Error",
  • "message": "Cannot delete. Invalid Offer id"
}

updates only the <Status> field of the offer

Matching Service (available --> used)

Request Body schema: application/json

offer to be published.

status
string
Enum:"available" "matched" "used" "cancelled" "expired"

Responses

200

Returns complete info of the offer showing updated status field.

400

Invalid .

403

You do not have sufficient privileges to execute this operation.

404

does not exist.

put /offer/<offer_id>

SwaggerHub API Auto Mocking

https://virtserver.swaggerhub.com/FLOCX/Marketplace_service/1.0.0/offer/<offer_id>

SwaggerHub API Auto Mocking

https://virtserver.swaggerhub.com/FLOCX/Marketplace_Service/1.0.0/offer/<offer_id>

Request samples

Content type
application/json
Copy
Expand all Collapse all
{
  • "status": "used"
}

Response samples

Content type
application/json
Copy
Expand all Collapse all
{
  • "marketplace_offer_id": "b711b1ca-a77e-4392-a9b5-dc84c4f469ac",
  • "provider_offer_id": "90894712-3b21-4bf7-9899-b4234530ff8b",
  • "provider_id": "b9752cc0-9bed-4f1c-8917-12ade7a6fdbe",
  • "project_id": "12a59a51-b4d6-497d-9f75-f56c409305c8",
  • "marketplace_date_created": "(2016-07-16T19:20:30-04:00)",
  • "status": "used",
  • "server_id": "fb878e3e-9425-4285-babf-0e58a7b091b2",
  • "start_time": "(2016-07-16T19:20:30-04:00)",
  • "end_time": "(2016-08-16T19:20:30-04:00)",
  • "server_config":
    {
    },
  • "cost": 11
}

bid

Operations about buying servers

List all bids

Admin can list all bids. Matching Service Engine and non-creator users can only see the list of bids with status available.

Responses

200

Succesful operation.

get /bid

SwaggerHub API Auto Mocking

https://virtserver.swaggerhub.com/FLOCX/Marketplace_service/1.0.0/bid

SwaggerHub API Auto Mocking

https://virtserver.swaggerhub.com/FLOCX/Marketplace_Service/1.0.0/bid

Response samples

Content type
application/json
Copy
Expand all Collapse all
[
  • {
    }
]

Create a new bid

Adds attributes , , <Status = available> to the incoming bid

Request Body schema: application/json

bid to be published.

creator_bid_id
string <UUID>

id generated by the user creating the bid.

project_id
string <UUID>

project that created the bid

start_time
string <(yyyy-mm-ddThh:mm:ss-/+hh)>

ISO-8601 DateTime format with timezone difference from UTC eg '(Date-16 July 2016, Time 8-30 pm Boston time)'

end_time
string <(yyyy-mm-ddThh:mm:ss-/+hh)>

ISO-8601 DateTime format with timezone difference from UTC eg '(Date-16 August 2016, Time 8-30 pm Boston time)'

duration
integer <int64>

Number of seconds available anytime between 'Start_time' and 'End_time'

server_quantity
integer <int32>
server_config_query
Array of strings (bid_hw_config)
cost
number <float64>

States ceiling price, the maximum asking price. Rate is charged per hour.

Responses

201

Bid added to marketplace successfully.

400

Invalid input data.

post /bid

SwaggerHub API Auto Mocking

https://virtserver.swaggerhub.com/FLOCX/Marketplace_service/1.0.0/bid

SwaggerHub API Auto Mocking

https://virtserver.swaggerhub.com/FLOCX/Marketplace_Service/1.0.0/bid

Request samples

Content type
application/json
Copy
Expand all Collapse all
{
  • "creator_bid_id": "12a59a51-b4d6-497d-9f75-f56c409305c8",
  • "project_id": "12a59a51-b4d6-497d-9f75-f56c409305c8",
  • "start_time": "(2016-07-16T19:20:30-04:00)",
  • "end_time": "(2016-08-16T19:20:30-04:00)",
  • "duration": 16400,
  • "server_quantity": 80,
  • "server_config_query":
    [
    ],
  • "cost": 11
}

Response samples

Content type
application/json
Copy
Expand all Collapse all
{
  • "marketplace_bid_id": "90894712-3b21-4bf7-9899-b4219730ff8b",
  • "creator_bid_id": "12a59a51-b4d6-497d-9f75-f56c409305c8",
  • "project_id": "12a59a51-b4d6-497d-9f75-f56c409305c8",
  • "start_time": "(2016-07-16T19:20:30-04:00)",
  • "server_quantity": 80,
  • "end_time": "(2016-08-16T19:20:30-04:00)",
  • "duration": 164,
  • "status": "available",
  • "server_config_query":
    [
    ],
  • "cost": 11
}

Display data about a particular bid.

Admin can query any bid by its bid_id. Non-admin user can query any 'available' bid and any bid that he created himself.

Responses

200

Succesful operation.

400

Invalid

403

You do not have sufficient privileges to access this resource! Will occur when an non-admin user is trying to access a bid created by other user and the status of the bid is anything else except 'available'

404

does not exist.

get /bid/<bid_id>

SwaggerHub API Auto Mocking

https://virtserver.swaggerhub.com/FLOCX/Marketplace_service/1.0.0/bid/<bid_id>

SwaggerHub API Auto Mocking

https://virtserver.swaggerhub.com/FLOCX/Marketplace_Service/1.0.0/bid/<bid_id>

Response samples

Content type
application/json
Copy
Expand all Collapse all
{
  • "marketplace_bid_id": "90894712-3b21-4bf7-9899-b4219730ff8b",
  • "creator_bid_id": "12a59a51-b4d6-497d-9f75-f56c409305c8",
  • "project_id": "12a59a51-b4d6-497d-9f75-f56c409305c8",
  • "start_time": "(2016-07-16T19:20:30-04:00)",
  • "server_quantity": 80,
  • "end_time": "(2016-08-16T19:20:30-04:00)",
  • "duration": 164,
  • "status": "available",
  • "server_config_query":
    [
    ],
  • "cost": 11
}

Deletes the particular bid.

Sets the status field of the bid to "cancelled"

Responses

200

Bid cancelled successfully

400

Invalid

403

You do not have sufficient privileges to execute this operation. Non-admin or non-owner user cannot update the status field of the bid.

404

does not exist.

delete /bid/<bid_id>

SwaggerHub API Auto Mocking

https://virtserver.swaggerhub.com/FLOCX/Marketplace_service/1.0.0/bid/<bid_id>

SwaggerHub API Auto Mocking

https://virtserver.swaggerhub.com/FLOCX/Marketplace_Service/1.0.0/bid/<bid_id>

Response samples

Content type
application/json
Copy
Expand all Collapse all
{
  • "status": "Error",
  • "message": "Invalid bid id"
}

updates only the <Status> field of the bid.

Matching Service (available --> used)

Request Body schema: application/json

Bid to be updated.

status
string
Enum:"available" "matched" "used" "cancelled" "expired"

Responses

200

Returns complete info of the bid showing updated status field.

400

Invalid

403

You do not have sufficient privileges to execute this operation.

404

does not exist.

put /bid/<bid_id>

SwaggerHub API Auto Mocking

https://virtserver.swaggerhub.com/FLOCX/Marketplace_service/1.0.0/bid/<bid_id>

SwaggerHub API Auto Mocking

https://virtserver.swaggerhub.com/FLOCX/Marketplace_Service/1.0.0/bid/<bid_id>

Request samples

Content type
application/json
Copy
Expand all Collapse all
{
  • "status": "matched"
}

Response samples

Content type
application/json
Copy
Expand all Collapse all
{
  • "marketplace_bid_id": "90894712-3b21-4bf7-9899-b4219730ff8b",
  • "creator_bid_id": "12a59a51-b4d6-497d-9f75-f56c409305c8",
  • "project_id": "12a59a51-b4d6-497d-9f75-f56c409305c8",
  • "start_time": "(2016-07-16T19:20:30-04:00)",
  • "server_quantity": 80,
  • "end_time": "(2016-08-16T19:20:30-04:00)",
  • "duration": 164,
  • "status": "matched",
  • "server_config_query":
    [
    ],
  • "cost": 11
}

contract

Operations about Contracts

List all contracts

Admin can list all contracts. Non-admin users can only see the list of contracts that involve the offers and bids they made.

Responses

200

Succesful operation.

get /contract

SwaggerHub API Auto Mocking

https://virtserver.swaggerhub.com/FLOCX/Marketplace_service/1.0.0/contract

SwaggerHub API Auto Mocking

https://virtserver.swaggerhub.com/FLOCX/Marketplace_Service/1.0.0/contract

Response samples

Content type
application/json
Copy
Expand all Collapse all
[
  • {
    }
]

Create a new contract

match_maker reads bids and offers from marketplace-service database. When a match between bid and offer is found, a contract is created.

Request Body schema: application/json
bid
object (Bid)
offers
Array of objects (Offer)

Responses

201

Updates users whose bids and offers are involved in the contract.

post /contract

SwaggerHub API Auto Mocking

https://virtserver.swaggerhub.com/FLOCX/Marketplace_service/1.0.0/contract

SwaggerHub API Auto Mocking

https://virtserver.swaggerhub.com/FLOCX/Marketplace_Service/1.0.0/contract

Request samples

Content type
application/json
Copy
Expand all Collapse all
{
  • "bid":
    {
    },
  • "offers":
    [
    ]
}

Response samples

Content type
application/json
Copy
Expand all Collapse all
{
  • "message": "Contract matched",
  • "contract_info":
    {
    }
}

Display data about a particular contract.

Admin can query any contract by its contract_id. Non-admin user can query any contract that involves the offers or bid they created.

Responses

200

Succesful operation.

400

Invalid .

403

You do not have sufficient privileges to access this resource! Will occur when an non-admin user is trying to access a contract created by other user.

404

does not exist.

get /contract/<contract_id>

SwaggerHub API Auto Mocking

https://virtserver.swaggerhub.com/FLOCX/Marketplace_service/1.0.0/contract/<contract_id>

SwaggerHub API Auto Mocking

https://virtserver.swaggerhub.com/FLOCX/Marketplace_Service/1.0.0/contract/<contract_id>

Response samples

Content type
application/json
Copy
Expand all Collapse all
[
  • {
    }
]

updates only the <Status> field of the contract.

Matching Service (executed --> finished)

Request Body schema: application/json

change status of the contract.

status
string
Enum:"matched" "executed" "finished" "expired" "cancelled"

Responses

200

Returns complete info of the bid showing updated status field.

400

Invalid

403

You do not have sufficient privileges to execute this operation.

404

does not exist.

put /contract/<contract_id>

SwaggerHub API Auto Mocking

https://virtserver.swaggerhub.com/FLOCX/Marketplace_service/1.0.0/contract/<contract_id>

SwaggerHub API Auto Mocking

https://virtserver.swaggerhub.com/FLOCX/Marketplace_Service/1.0.0/contract/<contract_id>

Request samples

Content type
application/json
Copy
Expand all Collapse all
{
  • "status": "finished"
}

Response samples

Content type
application/json
Copy
Expand all Collapse all
{
  • "contract_id": "b711b1ca-a77e-4392-abcd-dc84c4f469ac",
  • "time_created": "(2016-07-16T19:20:30-04:00)",
  • "bid_id": "b711b1ca-a77e-4392-abcd-dc84c4f469ac",
  • "offers":
    [
    ],
  • "start_time": "(2016-07-16T19:20:30-04:00)",
  • "end_time": "(2016-08-16T19:20:30-04:00)",
  • "cost": 11,
  • "status": "finished"
}

Deletes the particular Contract.

Sets the status field of the contract to "cancelled"

Responses

200

Contract cancelled successfully

400

Invalid or does not exist.

403

You do not have sufficient privileges to execute this operation. Non-admin or non-owner user cannot update the status field of the bid.

404

does not exist.

delete /contract/<contract_id>

SwaggerHub API Auto Mocking

https://virtserver.swaggerhub.com/FLOCX/Marketplace_service/1.0.0/contract/<contract_id>

SwaggerHub API Auto Mocking

https://virtserver.swaggerhub.com/FLOCX/Marketplace_Service/1.0.0/contract/<contract_id>

Response samples

Content type
application/json
Copy
Expand all Collapse all
{
  • "status": "Error",
  • "message": "Invalid Contract id"
}