# <font >Freespin Create</font>
## Description

> Through this method, operators can create free round reward activities for the game. When a network error occurs, the operator can send repeated requests to create a free round. If there is a valid FR reward with the same reward code, the system will not create a new RF reward.

> Request method:（ Host-> BeSoft）:post 

> Encoding method：application/x-www-form-urlencoded

> Besoft The response data format is: application/json

##  Method URL
```
{besoftapi}/api/bonus/create
```

## Hash computation
Hash code is calculated through the following steps:
Obtain all parameters (expected hash) from the request POST parameters and append them to the string:
- 1. Sort all parameters in alphabetical order.
- 2. Append them in key1=value1&key2=value2 (if the values are not empty)
- 3. Additional key, namely:
```
key1=value1&key2=value&hashkey=djds83h^&*j3u5j32
```
- 4. Calculate the hash using MD5 and convert it to all uppercase letters.
- 5. Append the name "hash" to the parameter instead of the hashkey field. The final parameter is:
```
key1=value1&key2=value&hash=3E8ABC6949A0A0CFF9110CF1128FBE25
```
- 6. If the comparison between the platform and the hash parameter fails. Send error code 1008.


##  Request Parameters

 |      Name      |    Type     | Required |                    Description                     |
 | :------------: | :---------: | :------: | :------------------------------------------------: |
 |   extension1   |   string    |    Y     |                      Agent account                      |
 |      cert      |   string    |    Y     |                      Security code                      |
 |   bonuscode    | String(128) |    Y     |            The unique reward identifier in the operator system            |
 |     rounds     |    int32    |    Y     |                     Free rounds                     |
 |    maxscore    |    int64    |    Y     |           The upper limit of points that players can always obtain in this event           |
 |   startdata    |    int64    |    Y     |           The start timestamp of participation in the reward activity (in milliseconds)           |
 |    enddata     |    int64    |    Y     |           The end timestamp of participation in the reward activity (in milliseconds)          |
 |  validitydata  |    int64    |    Y     |            The deadline timestamp (in milliseconds) after the player takes effect            |
 |     games      |   string    |    Y     | json array string, configure the games that can be participated in, and the game betting information |
 |   games.gid    |   string    |    Y     |                      Game gid                       |
 | games.betindex |    int32    |    Y     |                    Game betting index                    |
 |  games.betmu   |    int32    |    Y     |                    Game betting multiple                    |
 |      hash      |   string    |    Y     |                   The requested hash code                   |




**The game betting configuration can be obtained through the interface:** [Get Bet Config](en/freespin_gamebetconfi)

## Example
- URL:
    - http://127.0.0.1:8000/api/bonus/create
- HTTP Method
    -   POST
- Form Data
    > Content-Type: application/x-www-form-urlencoded
    ``` 
    extension1:     adminweb
    cert:           v8VMKKzlPpD0te4rX99Hgefs3PQrBFWJKiuUqg6Y
    bonuscode:      aaabbbccc
    rounds:         11
    maxscore:       1000
    startdata:      1752042214512
    enddata:        1752052214512
    validitydata:   1752152214512
    games:          [
                        {
                            "gid": "be001",
                            "betindex": 0,
                            "betmul": 1
                        },
                        {
                            "gid": "be022",
                            "betmul": 1,
                            "betindex": 0
                        }
                    ]
    hash:           3E8ABC6949A0A0CFF9110CF1128FBE25
    ```
	
	
## Return Result

 | Name | Type| Description |
 |:--------:|:-----:|:--------:|
 | ret | int |  status code   |
 | info | string | Result description |


 ##  Successful Result

```
{
	"ret": -1,
	"info": "ok"
}
```


 ## Failed Result

```
{
	"ret": 1008,
	"info": "param erro"
}
```