Friendbot request fails with 400 (Bad Request)
Friendbot request fails with 400 (Bad Request)
Loading saved threads...
Ebube · External communityPost link
External question — Stellar Stack Exchange
Author: Ebube
Original post: https://stellar.stackexchange.com/questions/2500
License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/
Adaptation: HTML converted to plain text; contact email addresses removed.
I am trying to create an account on the stellar Test Network. I am using ASP .Net framework. But whenever I make a request and pass in the public key, I always get this error:
Response status code does not indicate success: 400 (Bad Request)
.
I'll add that I am using the Javascript documentation from
here
and converting it to C# code because I didn't find any documentation for C#. Is there anything I'm missing out?
this is how the code looks:
try {
string url = "https://friendbot.stellar.org?addr=" + Uri.EscapeDataString(pair.PublicKey);
HttpResponseMessage response = await client.GetAsync(url);
string responseBody = await client.GetStringAsync(url);
object responseObject = JsonConvert.DeserializeObject<object>(responseBody);
return Ok(responseObject);
} catch(Exception ex) {
return BadRequest("Could not Establish a successful connection with Stellar because " + ex.Message);
}
Quote
Report
Ebube · External communityPost link
External answer — Stellar Stack Exchange
Author: Ebube
Original post: https://stellar.stackexchange.com/a/2501
License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/
Adaptation: HTML converted to plain text; contact email addresses removed.
Finally Got it to work. Switched from using the public key to using the address.
try
{
KeyPair pair = KeyPair.Random();
string url = "https://friendbot.stellar.org?addr=" + pair.Address;
string responseBody = await client.GetStringAsync(url);
object responseObject = JsonConvert.DeserializeObject<object>(responseBody);
return Ok(responseObject);
}catch(Exception ex)
{
return BadRequest("Could not Establish a connection with Stellar because " + ex.Message);
}
Quote
Report
Post Reply
Quoted from Forex.com.bd-Editorial External question — Stellar Stack Exchange Author: Ebube Source score (net votes, not local likes): 0 Original post: https://stellar.stackexchange.com/questions/2500 License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/ Adaptation: HTML converted to plain text; contact email addresses removed. I am trying to create an account on the stellar Test Network. I am using ASP .Net framework. But whenever I make a request and pass in the public key, I always get this error: Response status code does not indicate success: 400 (Bad Request) . I'll add that I am using the Javascript documentation from here and converting it to C# code because I didn't find any documentation for C#. Is there anything I'm missing out? this is how the code looks: try { string url = "https://friendbot.stellar.org?addr=" + Uri.EscapeDataString(pair.PublicKey); HttpResponseMessage response = await client.GetAsync(url); string responseBody = await client.GetStringAsync(url); object responseObject = JsonConvert.DeserializeObject<object>(responseBody); return Ok(responseObject); } catch(Exception ex) { return BadRequest("Could not Establish a successful connection with Stellar because " + ex.Message); }
Checking account access…