Integrate Rest Api in appium code

Can we use Rest api in the appium code to run the test.For eg, need to use upload image api in appium to upload image to the server.

Yes you can use rest api in appium code. There are some maven dependincies also you have use those in you pom.xml. You can use your application restapi’s by adding the jar to your buildpath.

Thanks for the reply.

i have tried creating maven project and added the dependencies , but can you give me an idea on how to add the application api and use it in appium test.

Please ask your dev to provide the api’s jar file and add it your current project build path. Later you have to use the respective methods to done the job.

In Eclipse

  1. Right click on your project folder.
  2. Go to build path.
  3. Click on Add External jars.
  4. Chhose yopur external api.jar file.
  5. Click enter.
  6. Click apply and close.

Now successfully you added the api jar file to your project.

Now you have to use respective method from that jar file to upload image.

Thanks for helping me. But we have apis created in PHP and laravel framework. So they have no jar files for that apis.

But do you have any work around for, sending a dummy image to camera without actually capturing it.

No idea with php.

If you just want to upload a dummy image ,In your application can’t you upload a image through UI ?

In application there is no option to upload image instead we have to capture image from camera and proceed.So that’s why i was asking whether we can send/upload images from a ( remote server) location directly to server without capturing from camera.