Coder Social home page Coder Social logo

Comments (11)

bytestostring avatar bytestostring commented on July 18, 2024

@ppoiissbsjksms

Hi, you can use the API Method "rmnodes", but the method does remove only by node Id.
I think I will write another method to remove nodes by IP and will inform you.

from nkn.ovh.

ppoiissbsjksms avatar ppoiissbsjksms commented on July 18, 2024

How do I use "rmnodes" to delete nodes?

ps: server2 run "rmnodes"

from nkn.ovh.

ppoiissbsjksms avatar ppoiissbsjksms commented on July 18, 2024

Bro,I'm sorry,I don't understand the code
Can you teach me how to use it?Thank you

from nkn.ovh.

bytestostring avatar bytestostring commented on July 18, 2024

@ppoiissbsjksms
Please use the new method: "rmnodesbyip"

Example for cURL, application/x-www-form-urlencoded (multiple $IP must be splitted by comma):

curl -X POST  \
-d 'Method=rmnodesbyip' \
-d 'NodesIp=$IP' \
-d 'Hash=$HASH' \
-H "Content-Type: application/x-www-form-urlencoded" \
 https://nkn.ovh/api

Example for cURL, application/json:

curl -d '{"Method":"rmnodesbyip","Value":{"Hash":"$HASH", "NodesIp":["127.0.0.1", "127.0.0.2", "127.0.0.3"]}}' -H "Content-Type: application/json"  https://nkn.ovh/api

from nkn.ovh.

ppoiissbsjksms avatar ppoiissbsjksms commented on July 18, 2024

Bro.Thank you very much

from nkn.ovh.

bytestostring avatar bytestostring commented on July 18, 2024

@ppoiissbsjksms
np.
Also you should update to the latest version.

from nkn.ovh.

ppoiissbsjksms avatar ppoiissbsjksms commented on July 18, 2024

yeah,I am updating

from nkn.ovh.

ppoiissbsjksms avatar ppoiissbsjksms commented on July 18, 2024

I think it's better to use the node ID than the node IP

from nkn.ovh.

bytestostring avatar bytestostring commented on July 18, 2024

I think it's better to use the node ID than the node IP

Then you will need send two POST requests and handling the result by a script:

The first:

curl -X POST  \
-d 'Method=getmynodes' \
-d 'Hash=$HASH' \
-H "Content-Type: application/x-www-form-urlencoded" \
 https://nkn.ovh/api

After the request you have to find ID....
We got response like this:

{"Method":"getmynodes","Code":0,"Error":false,"Value":{"List":[
{"IP": "127.0.0.1", "NodeId": 1,  ...... a lot of information }, 
{"IP": "127.0.0.2", "NodeId": 2,  ...... a lot of information }, 
{"IP": "127.0.0.3", "NodeId": 3,  ...... a lot of information}, 
{"IP": "127.0.0.4", "NodeId": 4,  ...... a lot of information}
]}}

If you have a script who handling JSON Array["Value"]["List"], then you will can try to use that.
Otherwise it's very uncomfortable.

The second request (remove a node by id):

curl -X POST  \
-d 'Method=rmnodes' \
-d 'NodesId=$ID' \
-d 'Hash=$HASH' \
-H "Content-Type: application/x-www-form-urlencoded" \
 https://nkn.ovh/api

from nkn.ovh.

ppoiissbsjksms avatar ppoiissbsjksms commented on July 18, 2024

Can I request the ID of an unmined node?

PS:
{"Method":"getmynodes","Code":0,"Error":false,"Value":{"List":[
{"IP": "127.0.0.1", "NodeId": 1, ...... a lot of information },
{"IP": "127.0.0.2", "NodeId": 2, ...... a lot of information },
{"IP": "127.0.0.3", "NodeId": 3, ...... a lot of information},
{"IP": "127.0.0.4", "NodeId": 4, ...... a lot of information}
]}}

So I can always replace them

from nkn.ovh.

bytestostring avatar bytestostring commented on July 18, 2024

You should parse the array manually.
I cannot write a function for each of your filtering.

API is created for programmers, it will not be difficult to parse the array manually.
https://github.com/bytestostring/nkn.ovh/blob/v1.1/API.md

from nkn.ovh.

Related Issues (17)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.