Invoke POST WebAPI

Hi,

I have created a!writeToDataStore in webAPI which is writing to DB when I test through API,to invoke this API I created an integration of Method POST and URL accepting ri! as parameters.

I am unable to write to DB when I test through integration.Can someone please help where I am going wrong.

Later I want to use this integration in my interface.

Thanks in advance!

  Discussion posts and replies are publicly visible

Parents
  • You can use a!writeToDataStore() directly in your Appian interface.

    In the onSuccess and onFailure parameters of a!writeToDatastore you can return an HTTP response using the a!httpResponse() function. I recommend using this to help you view useful information when testing in the API designer. 

  • 0
    A Score Level 1
    in reply to Danny Verb

    Hi  

    Thanks for the reply I tried that only first,

    but this is what I get in response,not sure what I am missing.

    a!localVariables(
      local!value:
      a!writeToDataStoreEntity(
      dataStoreEntity: cons!DS,
      valueToStore: ri!variable,
      onSuccess: a!httpResponse(
        statusCode: 200,
        headers: {
          a!httpHeader(name: "Content-Type", value: "application/json")
        },
        body: a!toJson(
          fv!storedValues
        )
      ),
      onError: a!httpResponse(
        statusCode: 500,
        headers: {
          a!httpHeader(name: "Content-Type", value: "application/json")
        },
        body: a!toJson(
          {
            error: "There was an error writing to the data store"
          }
        )
      )
    ),
    local!value
    )

Reply
  • 0
    A Score Level 1
    in reply to Danny Verb

    Hi  

    Thanks for the reply I tried that only first,

    but this is what I get in response,not sure what I am missing.

    a!localVariables(
      local!value:
      a!writeToDataStoreEntity(
      dataStoreEntity: cons!DS,
      valueToStore: ri!variable,
      onSuccess: a!httpResponse(
        statusCode: 200,
        headers: {
          a!httpHeader(name: "Content-Type", value: "application/json")
        },
        body: a!toJson(
          fv!storedValues
        )
      ),
      onError: a!httpResponse(
        statusCode: 500,
        headers: {
          a!httpHeader(name: "Content-Type", value: "application/json")
        },
        body: a!toJson(
          {
            error: "There was an error writing to the data store"
          }
        )
      )
    ),
    local!value
    )

Children