commons/server
Jernej Pregelj 8cb13287db
Merge branch 'master' into feature/change-metadata
2019-05-16 15:15:54 +02:00
..
src Merge branch 'master' into feature/change-metadata 2019-05-16 15:15:54 +02:00
test more tests 2019-05-04 04:27:27 +02:00
Dockerfile task cleanup 2019-04-12 16:26:13 +02:00
README.md ddo path 2019-04-29 18:47:25 +02:00
package-lock.json Merge branch 'master' into feature/change-metadata 2019-05-16 15:15:54 +02:00
package.json Merge branch 'master' into feature/change-metadata 2019-05-16 15:15:54 +02:00
tsconfig.json one dev interface for client & server 2019-03-23 22:10:00 -03:00

README.md

banner

Commons: Server

Introduction

This folder contains server component written in TypeScript using Express. The server provides various microservices, like remote file checking, retiring and updating metadata.

To spin up the server in a watch mode for local development, execute:

npm install
npm start

API Documentation

1. Url Checker

Url Checker returns if file exists, size and additional information about requested file. This service is used as a solution to frontend CORS restrictions.

Endpoint: POST /api/v1/urlcheck

Input Parameters:

{
    "url": "https://oceanprotocol.com/tech-whitepaper.pdf"
}

Return Value

{
    "status": "success",
    "result": {
        "found": true,
        "contentLength": "2989228",
        "contentType": "application/pdf"
    }
}

Return Value (file not found)

{
    "status": "error",
    "message": null
}

2. Retire asset

Retires asset from Commons Marketplace. To verify owner, he needs to sign You are retiring <asset did> with crypto wallet and send in both signature and did.

Endpoint: DELETE /api/v1/ddo/<asset did>

Input Parameters:

{
    "signature": "<signature of `You are retiring <asset did>`>"
}

Return Value

{
    "status": "success"
}

Return Value (wrong signature)

{
    "status": "error",
    "message": "Not owner of asset"
}

3. Update asset

Updates asset on Commons Marketplace. To verify owner, he needs to sign You are updating <asset did> with crypto wallet and send in both signature and did.

Endpoint: PUT /api/v1/ddo/<asset did>

Input Parameters:

{
    "metadata": "TBD",
    "signature": "<signature of `You are retiring <asset did>`>"
}

Return Value

{
    "status": "success"
}

Return Value (wrong signature)

{
    "status": "error",
    "message": "Not owner of asset"
}

🎁 Contributing

See the page titled "Ways to Contribute" in the Ocean Protocol documentation.

🏛 License

Copyright 2018 Ocean Protocol Foundation Ltd.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.