function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
dai tran 6dai tran 6 

How can call httpPost of Rest API?

Apex Rest API:
        global static Integer checklogin(String email, String password ) {
                List<AccountUser__c>  listacc =  [SELECT email__c,Password__c,AccountId__r.type FROM AccountUser__c   WHERE Status__c=1 and email__c=:email and Password__c=:password   LIMIT 1];       
                    return 1;
                    return 0;
Call Rest Api from android:
url = ""
    client = OkHttpClient()

    jsonIn = FormBody.Builder()

    request = Request.Builder()
           .header("Authorization", "Bearer "+accesstoken)
           .addHeader("Content-Type", "application/json")

        response = client.newCall(request).execute()

[{"errorCode":"UNSUPPORTED_MEDIA_TYPE","message":"Content-Type header specified in HTTP request is not supported: application/x-www-form-urlencoded"}]
How can call httpPost  of Rest API?