# How to generate a request JSON Object

### Java code for all API methods



```
RACARequest racarequest = new RACARequest(); racarequest.setRequestData(encodedString);
racarequest.setUserName(userName);
// Converting the CertUtil class object to Json ObjectWriter ow1 = new
ObjectMapper().writer().withDefaultPrettyPrinter();
String json1 = ow1.writeValueAsString(racarequest);
```

<table data-header-hidden><thead><tr><th width="163">Input</th><th width="117">Presence</th><th width="132">Data Type</th><th>Description</th></tr></thead><tbody><tr><td><p> </p><p>encodedString</p></td><td>M</td><td>String</td><td>You need to pass BASE 64 encoded JSON object which is output of section 6.</td></tr><tr><td><p> </p><p>userName</p></td><td>M</td><td>String</td><td>You need to pass username that is registered with emCA for API process.</td></tr></tbody></table>

### .Net Code for All API methods

```
string jsonrequestData = "{\"requestData\":\"" + < encodedString> + "\”," + "\" userName\":\"" + < userName > +"\"}";
```

<table data-header-hidden><thead><tr><th width="166">Input</th><th width="113">Presence</th><th width="129">Data Type</th><th>Description</th></tr></thead><tbody><tr><td>encodedString</td><td>M</td><td>String</td><td><p> </p><p>You need to pass BASE 64 encoded JSON object which is output of section 6.</p></td></tr><tr><td>userName</td><td>M</td><td>String</td><td>You need to pass username that is registered with emCA for API process.</td></tr></tbody></table>



### Common Error Message

| Invalid parameter                            | If input parameter is missing                                                                 |
| -------------------------------------------- | --------------------------------------------------------------------------------------------- |
| <p> </p><p>Invalid input data</p>            | If decryption of request input data failed due to incorrect AES key used for encryption. etc. |
| <p> </p><p>Invalid request details found</p> | If the Authentication failed i.e., incorrect username/password/IP Address                     |
| Internal server error                        | Server-side error (if any)                                                                    |
