{title='api'} # fishcoins api you use `GET` along with various urls with parameters, listed below - responses are in JSON - the base url is /fishcoin/api (PHP implementation in `backend/fishcoin-api.php`) ## endpoints ---
### ✎ generate your wallet ` ?genwallet&name= ` - each wallet begins with no fishcoin, a wallet name, and a wallet key. do not lose it! - names are 20 char max, letters only, and must be original - **success response:**
```json { "wallet_key": "" } ```
- **fail response:** ```json { "error": "invalid_name" } ``` ---
### ↙ collect payment ` ?collect&key=&code= ` - collect payments using codes - **success response:** ```json { "new_balance": , "amount_received": , "receipt_message": "", "receipt_img": "" } ``` - **fail responses:** ```json { "error": "code_not_found" } ``` ```json { "error": "code_yields_no_coins" } ``` ```json { "error": "wallet_not_found" } ``` ```json { "error": "code_already_used" } ``` ---
### ↗ generate payment code ` ?genpaycode&key=&amount=&receipt-message=&receipt-img=&equation= ` - equations determine the final amount that each code brings. see the [equation documentation](/fishcoin/equation) for more info. - if not using the wrapper, the images must be uploaded beforehand using the [image upload tool](/fishcoin/imgupload) - **success response:** ```json { "code": "" } ``` - **fail responses:** ```json { "error": "invalid_amount_or_equation" } ``` ```json { "error": "invalid_key" } ``` ```json { "error": "invalid_image_id" } ``` ---
### ? gather information ` ?inquire&search= ` - enter a name to see their amount and rank, enter a wallet key to see your receipts, or enter a code to see what it's worth. - **search wallet name** ```json { "wallet": "", "fishcoins": , "rank": , "total_wallets": } ``` - **search wallet key** ```json { "name": "", "receipts": [ { "receipt_message": "", "receipt_img": "", "timestamp": "", "peer": "", "amount": } ] } ``` - **search payment code** ```json { "creator": "", "value": } ``` - **fail response:** ```json { "error": "not found" } ``` ---
### x remove payment code ` ?deletecode&code=&key= ` - deletes a payment code, useful for keeping the systems efficient. - if you're creating an application that utilizes this api, consider deleting codes when they're no longer useful. - **success response:** ```json { "success": "code deleted successfully" } ``` - **fail responses:** ```json { "error": "missing parameters. required: code, wallet_key." } ``` ```json { "error": "code not found." } ``` ```json { "error": "unauthorized. invalid wallet key." } ``` ---
### extras (gambling, screensaver, …) ` ?extra&type=&…params… ` - same URL shape as the old site (`extra` with an empty value, then `type` and game params) - **`slots`:** `key`, `bet` (min 300), `spins` (1–20) → `{ "multipliers": [ … ] }` - **`plinko`:** `key`, `bet`, `balls` (1–50), `risk` (`low` | `medium` | `high`) → `{ "multipliers": [ … ] }` - **`screensaver`:** `action` = `start` | `pos` | `end` (plus `wallet`, `auth` on start; `id`, `sec` on pos; `id` on end) - implementation: `backend/fishcoin/gambling/` (called from `backend/fishcoin-api.php`) ---
### other (useful?) general info - every payment code is a 9-character alpha-numeric string - each wallet key is a 20-character alpha-numeric string - the equations to determine amount are very powerful. you can use them to distribute things like freebies - there are some freebie codes located around the website. they can be used once per wallet and will come from the mint until it runs dry. - each wallet maintains a list of receipts for every transaction. you can see what each receipt includes in the example in [gather information](/fishcoin/api-docs#gather-info)