Cucumber for Appian: Post http post web api request

Hello everyone, I am currently trying to post a http post request using Cucumber for Appian to the Appian system itself using the cheat sheet made available by Appian. But I am facing errors and I am unsure what Im supposed to put in the 'BODY' parameter. Please see below:


Cucumber scripts cheat sheet: 

# Call a web API with a body and return result as a string. User defined by username must have permission to access the web API:
Given I post web api "WEB_API_ENDPOINT" with body "BODY" with username "USERNAME"

Cucumber script in .feature file: 
Given I post web api "">appian-example.com/.../createNewProduct" with body "" with username "example_appian"

Error: And I post web api "">appian-example.com/.../createNewProduct" with body "" with username "example_appian" # CucumberBaseFixture.postWebApiWithBodyWithUsername(String,String,String)
com.appiancorp.ps.automatedtest.exception.GenericTestException: message:<<An error has occurred: Call Web API>>
at com.appiancorp.ps.automatedtest.exception.ExceptionBuilder.build(ExceptionBuilder.java:71)
at com.appiancorp.ps.automatedtest.common.AppianWebApi.callWebApi(AppianWebApi.java:51)
at com.appiancorp.ps.automatedtest.fixture.BaseFixture.postWebApiWithBodyWithUsername(BaseFixture.java:672)
at com.appiancorp.ps.cucumber.fixtures.CucumberBaseFixture.postWebApiWithBodyWithUsername(CucumberBaseFixture.java:106)
at ✽.I post web api "">appian-example.com/.../createNewProduct" with body "" with username "example_appian"(src/test/resources/ApplicationExample.feature:75)

  Discussion posts and replies are publicly visible

Parents
  • Hello Rabiah,

    A post operation requires a body, which means the parameters you are sending are in the body (create a new client, update the client, delete the client with id #)

    If you webapi Justo query information is more likely to be a get operation. On which you don’t have to pass parameters.

    From your example you are trying to create a new product so you need to pass all the data of the product you are trying to create I guess you are using Json?

    Maybe something like

    {productName:“product1”}

    Hope this helps

    Jose

Reply
  • Hello Rabiah,

    A post operation requires a body, which means the parameters you are sending are in the body (create a new client, update the client, delete the client with id #)

    If you webapi Justo query information is more likely to be a get operation. On which you don’t have to pass parameters.

    From your example you are trying to create a new product so you need to pass all the data of the product you are trying to create I guess you are using Json?

    Maybe something like

    {productName:“product1”}

    Hope this helps

    Jose

Children