Ethereum: “Signature for this request is not valid.”
API EThereum request problem: using variables in the parameters
As a developer Ethereum, you are likely to be familiar with the importance of using names and types of data in your requests. However, a general question arises while working with variables that must be transmitted as parameters. In this article, we will examine why the application subscription rejects your variables {{Sellprice}} and provides a solution.
“The signature of this request is not valid”
When sending an API request to postman or other tool, it is necessary to specify the name of the parameter (without prices) followed by the type of information (for example {{Sellprice}} ). The exact syntax may vary according to the bees terminal and its specific requirements. However, the general question arises when the variables are used without citations.
{{}}} syntax problem
In JavaScript, the letters of the model (}) and the string internounces (
$ {...}
) are different behaviors in terms of variables. When using {}}
, Postman interprets the name of the variable to start {}
, which can lead to problems if the variable contains special characters or spaces.
For example, consider a request that has such a parameter:
`Json
Post/bees/price http/1.1
Content type: App/Json
{
“Price”: ”
{Sellprice}”,
“Symbol”: “{{symbol}}”
}
`
If you use the{}}to transmit the variable
Sellprice
, the Postman recognizes it as a literal and ignore it in the request organism.
Why {{}}} is not valid
To solve this problem, you will have to escape the characters “$}around the variable double curl threats ({{{...}}
). This says to Postman that the following parts are a place for the values:
`Json
Post/bees/price http/1.1
Content type: App/Json
{
“Price”: ”
{Sellprice}”,
“Symbol”: “{{symbol}}”
}
`
Solution
If you want to use a variable {{Sellprice}} Request, follow these steps:
- Escape{}
variable with double curly pants (
{{…}}}).
- Keep the rest of the syntax intact.
- Replace the postman in{{}}
{{{...}}}>
.
Here is an updated example:
`Json
Post/bees/price http/1.1
Content type: App/Json
{
“Price”: ”
{Sellprice}”,
“Symbol”: “{{symbol}}”
}
`
Tips and variants
- If you use a model engine (such as handlebar or mustache), it is necessary to use{{Changyable_name}
syntax
{}.
- In some cases, it may be necessary to use individual quotes (
) variable around your name if it contains special characters. For example:
`Json
Post/bees/price http/1.1
Content type: App/Json
{
“Price”: “‘
{Sellprice}’,”,
“Symbol”: “{{symbol}} ‘”
}
`
Following these steps, you should be able to use the {{Sellprice}} variable in the API request parameters.
Conclusion
The use of variables with special characters or spaces can lead to errors when sending requests to postman. Passing "{}" curly a double curly ({{…}}>`), you can make sure that the postman interprets and moves the values correctly as needed.