Hi there!
I’m an developer and experimenting NEM api. In fact I’ve installed the NCC client and created 2 wallets with 0 XEM of each wallet for testing purpose.
Account info request works as expected with url http://localhost:7890/account/get?address=NC7JJ35XVX7QFWW24ZFH5QJFYMAF3W3LB54FUXZO
Sending transaction request with url: http://localhost:7890/transaction/prepare-announce. I’m using Postman Chrome extension for experimenting:
Json object sent to server is
{
"transaction": {
"timeStamp": 1455782672,
"amount": 1000,
"fee": 30,
"recipient": "NC7JJ35XVX7QFWW24ZFH5QJFYMAF3W3LB54FUXZO",
"type": 257,
"deadline": 9154726,
"message": {
"payload": "74657374207472616e73616374696f6e",
"type": 1
},
"version": -1744830463,
"signer": "my-publickey-is-here"
},
"privateKey": "my-privatekey-is-here"
}
and is sent as a body of request (raw and application/json) type. The request is of type POST.
The api document mentions using of requestPrepareAnnounce. But here using postman I didn’t include this param anywhere.
The following is the response:
{
"innerTransactionHash": {},
"code": 20,
"type": 1,
"message": "FAILURE_WRONG_NETWORK",
"transactionHash": {
"data": "1c2742193373bdd7481041a745fa23172829f9ee8ba8352b4c9b84ce85bcfa02"
}
}
As document states: Entity was rejected because it has the wrong network specified.
This is not clear what is happening. Maybe that is because the wrong usage of Postman.
I’ve also tried my own pc’s ip adress 192.168.143.1 instead of using localhost. In this case the response is:
{
"timeStamp": 28283190,
"error": "Unauthorized",
"message": "remote 192.168.143.1 attempted to call local /transaction/prepare-announce",
"status": 401
}
Maybe that is the case as document states: **The /transaction/prepare-announce API should be **
used only on TRUSTED and LOCAL nodes!
Aka I’m using local node, right? on my own local server (machine).
I’ve also tried to create an android client using HttpUrlConnection to experiment the api. This time I used Content-Type as application/x-www-form-urlencoded or application/json.
and send parameter “requestPrepareAnnounce=” + jsonString; Here jsonString is same as above json object.
The response is same as above:
{
"timeStamp": 28283190,
"error": "Unauthorized",
"message": "remote 192.168.143.1 attempted to call local /transaction/prepare-announce",
"status": 401
}
Attempt with retrofit
> @Headers(“Content-Type: application/json”)
@POST("transaction/prepare-announce") Call<ResponseBody> sendTransaction(@Body TransactionRequest requestPrepareAnnounce);
also returns same response:
{
"timeStamp": 28283190,
"error": "Unauthorized",
"message": "remote 192.168.143.1 attempted to call local /transaction/prepare-announce",
"status": 401
}
So how could I make transaction?
Any help would be appreciated!