Test NEM API using postman

Hi team, i want to use Postman to test the XEM/Mosaic transfer between account through API. How i can start it ? And here are some detail questions:

  • how to access test net ?
  • do i need to install another wallet just for test net access ?
  • any sample cases/documents can be use as reference ?

thanks.

1 Like

You just open Postman and make the needed request, e.g. something like this

1 Like

You can look at Portman collection:


Just replace node to some choosen testnet node and import into Portman.

how is the rest of setup, like head ? which URL i should call ?

Made small progress. be able to pull in all the API details to Postman. Next step is connect with testnet and send some simple API request.

thanks for the suport.

made small progress. be able to use Postman to call a testnet and get height. i can feel the door is open.

2 Likes

i got NEM admin transfer couple thousands XEM to my account (test) i feel rich now. I will start to play Mosaic and name place first.

setup two test accounts under test net. setup name space and sub name space and also created mosaic. created first batch of mosaic with 10K and transferred from XEM and own mosaic to another account. NEM is very easy to create your currency and get business running. good job NEM team.

Thx :slight_smile:

i have spent some time on POSTMAN and API being provided. I feel not difficulty to pull some basic information from nem network, like account details, or name space, etc. But i can not find an API to enable to transfer XEM or Mosaic from my account to another. Can any one share some experience here ? Can i use a single API Post call to get this kind transfer happen ? thx.

There are two types of initating transaction (https://nemproject.github.io/#initiating-transactions):

  • /transaction/prepare-announce - it doesn’t require to sign yourself your transaction but you must provide your private key in request (signing will be done on NIS side). That’s why it should be used only with Local NIS!

  • /transaction/announce - in this transaction you must sign transaction yourself and you don’t send private key in request. It require some crypto libraries that’s why I recommend use here wrapper or sdk available for language you are using (https://www.nem.io/developers).

Pawelm. thanks for the inputs.

As i am using a script language for fx trading, which can support web request call. looks like neither option 1 ( i won’t be able to setup NIS for every user) or option 2 ( the language was not in the list) will be work for me.

I hope can get one single postman kind of call using json format to complete the job.

looks like i need to find some work around.

any suggestion will be welcome.

Option 1 could be for you if you store clients private keys on server side. Then you can run NIS on server and use it to sign your transactions (prepare-announce). It’s common approach for exchanges.

Option 2 is for you if private keys are on client side because you don’t want make api calls with your private key. Signing must be done on client side and for this you need do some crypto on client.
It’s still simple api call but you must sign transaction first with your private key. You can look at wrappers (written in js, c#, java, PHP and so on) and do the same.

for option 1, how can i store my private key on test net server , before i use post man to call that server and initiate a XEM or Mosaic transfer ?

for option 2, how i can do a signing on server, before sending the posman API call ? Can i Signing first using API call through postman (json format) then have another API call to initiate the xem transfer ?

i have downloaded C# sdk and Node.js sdk. personally, i feel NODE.JS SDK is more easy to follow. be able to use node.js to complete the xem transfer through API. will continue the exploring the load the program on node.js server and provide API service to other application.

@autratec If you prefer C# you should try this library:


Previous one is deprecated.

thanks for the sharing. i will try to complete my POC project using Node.js as it is moving pretty smooth. will back to C# if get time.