question

maria-nabil avatar image
maria-nabil asked David Marginian Deactivated answered

How to create order from an employee account using Rest Api ?

When I use this API to create order from the acoount of the employee ( using the authorization token that I got from Oauth2) :

var client = new RestClient("https://sandbox.dev.clover.com/v3/merchants/"+mid+ "/orders?access_token"+token );
            var request = new RestRequest(Method.POST);
            request.AddHeader("content-type", "application/json");
            request.AddParameter("application/json", "{\"employee\":{\"id\":\""+employee_id+"\"},\"total\":100}", ParameterType.RequestBody);
            IRestResponse response = client.Execute(request);

I got 401 unauthorized ,


But when I use the test API token that I created from the merchant dashboard it succeeded .

Can anyone say why this happens ?

Thanks in advance .

OrdersOAuthAPI TokenEmployees
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

David Marginian avatar image
David Marginian Deactivated answered

Does your application have the correct permissions set? If so, you need to make sure the app was installed after the permissions were set. If you changed the permissions you need to reinstall the app and get a new token.

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.

maria-nabil avatar image maria-nabil commented ·

Done this was the problem , I uninstalled the app and reinstalled it and it is solved , thank you .

0 Likes 0 ·

Welcome to the
Clover Developer Community