> For the complete documentation index, see [llms.txt](https://docs.facephi.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.facephi.com/docs.facephi-en/products/landing/resultados-y-callbacks/implementacion-basica.md).

# Basic implementation

## Implementation

The client-side implementation is quite simple; you must implement a POST call in your API or service with the following requirements:

* A post method that supports a maximum of 10 megabytes of `body parser`.

#### Implementation examples

In Javascript:

```javascript
const express = require('express');
const bodyParser = require('body-parser');
const app = express();

app.use(bodyParser.json({ limit: '10mb' }));

app.post('/example', (req, res) => {
  // Accede a los datos de la solicitud a través del cuerpo
  console.log(req.body);
  res.send('POST request received successfully');
});
```

In Java:

1. Import the necessary libraries, such as `org.springframework.web.bind.annotation.PostMapping` and `org.springframework.web.bind.annotation.RequestBody`.

```java
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
```

2. Create a route for the POST request and use the annotation `@RequestBody` to parse the request body.

```java
@PostMapping("/example")
public String example(@RequestBody String body) {
  // Accede a los datos de la solicitud a través del cuerpo
  System.out.println(body);
  return "POST request received successfully";
}
```

3. Configure the property `spring.servlet.multipart.max-request-size` in your application's configuration file (such as `application.properties`) to set the maximum request size limit.

```java
spring.servlet.multipart.max-request-size=10MB
```

With these steps, you have created a POST request in Java that supports a `body parser` of 10 MB. Note that the maximum request size limit can also be set through other options, such as `@RequestPart` and `MultipartConfigElement`.

> Note that the JSON objects sent by our service may not follow the same order shown in the documentation, and some fields may be null. It is essential to properly parse the received JSON objects. Below is an example of how to parse a JSON string, similar to what you might find in the response to a POST request, into a JSON object for consumption:
>
> ```java
> import org.json.JSONObject;
>
> public class JsonParser {
>
>     public static void main(String[] args) {
>         String jsonString = "{ \"resultJSON\": { \"imageFront\": \"IMAGE1\", \"imageBack\": \"IMAGE2\", \"imageSelfie\": "IMAGE3\" } }";
>         JSONObject jsonObject = new JSONObject(jsonString);
>
>         JSONObject resultJSON = jsonObject.getJSONObject("resultJSON");
>
>         String imageFront = resultJSON.getString("imageFront");
>         String imageBack = resultJSON.getString("imageBack");
>         String imageSelfie = resultJSON.getString("imageSelfie");
>
>         System.out.println("Image Front: " + imageFront);
>         System.out.println("Image Back: " + imageBack);
>         System.out.println("Image Selfie: " + imageSelfie);
>     }
> }
> ```
