# API Methods

## GET Method

GET method requests data from a specified resource without altering the state of the resource or causing any side effects.&#x20;

### **Code Samples for using the API**

**CURL**

```
// Some code
curl -X GET https://GETMethod.zerve.cloud/output
-H "Accept: application/json" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN"
```

**Python**

```python
// Some code
import requests
url = "https://GETMethod.zerve.cloud/output" 
api_token = "YOUR_API_TOKEN" # Replace with your actual API token
headers = { "Accept": "application/json", "Authorization": f"Bearer {api_token}" }
response = requests.get(url, headers=headers)
if response.status_code == 200:
    print(response.json())
else:
    print(f"Error: {response.status_code}, {response.text}")
```

#### Postman <a href="#responses" id="responses"></a>

<figure><img src="https://1018070783-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIQKNeqjEeOp9UwUcB9R9%2Fuploads%2FMDROU0c4Y05K1xdJBdqo%2Fpostman.png?alt=media&#x26;token=adda4cbc-afb8-4164-b555-68cf4ee7beb1" alt=""><figcaption><p>GET in Postman</p></figcaption></figure>

## POST Method

POST method is used to send data to the server so it can process it, save it, or perform an action.

### **Code Samples for using the API**

**CURL**

```
// Some code
curl -X GET https://ModelAPI.zerve.cloud/classifier
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN"
```

**Python**

```python
// Some code
import requests

url = 'https://ModelAPI.zerve.cloud/classifier'
data = {
    "payload" : {
    "realSum": [194.033698], 
    "room_shared": [false], 
    "room_private": [true],
    "person_capacity": [2.0]
    }
    }
response = requests.post(url, json=data)
if response.status_code == 200:
    print(response.json())
else:
    print(f"Error: {response.status_code}, {response.text}")

```

**Postman**

<figure><img src="https://1018070783-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIQKNeqjEeOp9UwUcB9R9%2Fuploads%2FDLqyXQPUWevRL5TRz4KY%2FPOST%20METHOD%20IN%20POSTMAN.png?alt=media&#x26;token=12757b54-1ea0-4446-b14b-acef886413ea" alt=""><figcaption><p>POST in Postman</p></figcaption></figure>

### **API Method Responses**

<table><thead><tr><th width="98">Status</th><th width="186">Meaning</th><th>Description</th></tr></thead><tbody><tr><td><strong>200</strong></td><td><strong>OK</strong></td><td>The request was successful, and the server is returning the requested data.</td></tr><tr><td><strong>204</strong></td><td><strong>No Content</strong></td><td>The server successfully processed the request but is not returning any content in the response body. </td></tr><tr><td><strong>400</strong></td><td><strong>Bad Request</strong></td><td>The server could not understand the request. This is usually due to malformed syntax, missing required parameters, or invalid data.</td></tr><tr><td><strong>401</strong></td><td><strong>Unauthorized</strong></td><td>The request requires user authentication.</td></tr><tr><td><strong>403</strong></td><td><strong>Forbidden</strong></td><td>The server understood the request, but the server refuses to authorize it.</td></tr><tr><td><strong>404</strong></td><td><strong>Not Found</strong></td><td>The requested resource could not be found on the server.</td></tr><tr><td><strong>500</strong></td><td><strong>Internal Server Error</strong></td><td>A generic error message indicating that an unexpected condition was encountered on the server (misconfiguration).</td></tr><tr><td><strong>502</strong></td><td> <strong>Bad Gateway</strong></td><td>The server, while acting as a gateway or proxy, received an invalid response from the upstream server it accessed.</td></tr></tbody></table>
