Post works with Openmrs rest api but not working in custom rest API

Attribute error occurring with custom API.

{

  "identifiers": [

    {

      "identifier": "1234-6",

      "identifierType": "8d79403a-c2cc-11de-8d13-0010c6dffd0f",

      "location": "8d6c993e-c2cc-11de-8d13-0010c6dffd0f",

      "preferred": true

    }

  ],

  "person": {

    "gender": "M",

    "age": 48,

    "birthdate": "1970-01-01T00:00:00.000+0100",

    "birthdateEstimated": false,

    "dead": false,

    "deathDate": null,

    "causeOfDeath": null,

    "names": [

      {

        "givenName": "Thoma1s6",

        "familyName": "Smi1th6"

      }

    ]

  }

}

Response received. https://pastebin.com/wLjAzuZH

please reply fast.

From your log, this means Caused by: org.openmrs.api.APIAuthenticationException: Privileges required: Get Identifier Types that you may not be logged in.

i have given id- admin; password; Admin@123 in authentication in header.

try {
				DefaultHttpClient httpclient = new DefaultHttpClient();

				httpclient.getCredentialsProvider().setCredentials(new AuthScope(AuthScope.ANY_HOST, AuthScope.ANY_PORT),
						new UsernamePasswordCredentials("admin", "Admin123"));

				
				HttpPost httppost = new HttpPost("http://192.168.0.111:8080/openmrs/ws/rest/v1/patient");
				System.out.println("executing request " + httppost.getRequestLine());
				httppost.addHeader("Accept", "application/json");
				httppost.addHeader("content-type", "application/json");
				try {
					//Set the request post body
			        StringEntity userEntity = new StringEntity(params1);
			        
			        httppost.setEntity(userEntity);
				} catch (UnsupportedEncodingException e) {
				    e.printStackTrace();
				}
				HttpResponse response;
				response = httpclient.execute(httppost);
				HttpEntity entity = response.getEntity();

				System.out.println("----------------------------------------\n" + response.toString());
				System.out.println(response.getStatusLine());

				BufferedReader br = new BufferedReader(new InputStreamReader((response.getEntity().getContent())));
				System.out.println("Output from Server .... \n");
				while ((output = br.readLine()) != null) {
					System.out.println(output);
				}

				if (entity != null) {
					System.out.println("Response content length: " + entity.getContentLength());
				}
				if (entity != null) {
					entity.consumeContent();
				}

				httpclient.getConnectionManager().shutdown();
			} catch (ClientProtocolException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			} catch (IOException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}

please reply fast.

Take a look at this: https://wiki.openmrs.org/display/docs/REST+Web+Services+API+For+Clients#RESTWebServicesAPIForClients-Authentication