question

shoaib-bagwan avatar image
shoaib-bagwan asked shoaib-bagwan commented

Clover android semi-integration - API response "401 Unauthorised"

Hello there,

"Sandbox environment" -- "401 Unauthorised" Error

1. I am trying to create an andorid-clover app where i need to create inventory item from my application
2. I am using android SDK for auth process here is the code 

override fun doInBackground(vararg params: Void?): AuthResult? {

    val client = OkHttpClient()

    val mediaType = "application/json".toMediaTypeOrNull()
    val body = RequestBody.create(mediaType, "{hidden:false,available:true,autoManage:false,defaultTaxRates:true,isRevenue:false,name:Gift Card -99 Minds ,price:100}")
    val request = Request.Builder()
        .url("https://sandbox.dev.clover.com/v3/merchants/RCTST0000008099/items")
        .post(body)
        .addHeader("content-type", "application/json")
        .addHeader("authorization", "Bearer "+mCloverAuth?.authToken)
        .build()

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

    Log.e("InventoryItemRequest", response.toString())

    return null
}
3. Everytime i use the above generated token i am receiving "401 Unauthorised"
4. I tried all the possible solution but no luck.

Please let me know what i am missing.

Thanks 
                 





InventoryOAuthAPI Token
10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
superdave avatar image
superdave answered shoaib-bagwan commented

https://sandbox.dev.clover.com/v3/merchants/RCTST0000008099/items


Replace RCTST0000008099 to your 13-character Clover ID for API calls

1 comment
10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

shoaib-bagwan avatar image shoaib-bagwan commented ·

Hello Superdave,

Here is what i get when Replace RCTST0000008099 to 13-character Clover ID

{protocol=http/1.1, code=400, message=Bad Request, url=https://sandbox.dev.clover.com/v3/merchants/*************/items}

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Welcome to the
Clover Developer Community