appian postman

I have created an apian web post API. api is working in appian and when i try to test it in postman its gives error 501. how can i test it in post man. need help. i already created outh credentials and also added the service user to the application groups.  

a!localVariables(
  local!value: cast(
    'type!{urn:com:appian:types:TFA}TFA_TESTING_RT',
    a!fromJson(http!request.body)
  ),
  a!writeToDataStoreEntity(
    dataStoreEntity: cons!TFA_data_store_constant,
    valueToStore: local!value,
    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"
        }
      )
    )
  )
)

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Senior Developer

    First go to admin console -> Web API Authentication -> Configure webapi key / connected system using a service account. After configuring it will give you clientId and clientsecret or webapi key depending on what you configure. Save the key somewhere and use it in postman.

    Then create a connected system in postman and use the webapi.

    In case of connected system use this config

    In case of webapi key use this config

    After this inherit the token and call your API subsequent web API address

    curl --location --request POST 'WEBAPI ADDRESS' \
    --header 'Authorization: Bearer  Token' \
    --header 'Content-Type: application/json' \
    --data-raw 'jsonRequestBody'
    Hope this will help you. Make sure the service account has at least viewer permission to web API. If you are calling a process model from this webapi then that service account must have at least initiator permission for the process model.
Reply
  • 0
    Certified Senior Developer

    First go to admin console -> Web API Authentication -> Configure webapi key / connected system using a service account. After configuring it will give you clientId and clientsecret or webapi key depending on what you configure. Save the key somewhere and use it in postman.

    Then create a connected system in postman and use the webapi.

    In case of connected system use this config

    In case of webapi key use this config

    After this inherit the token and call your API subsequent web API address

    curl --location --request POST 'WEBAPI ADDRESS' \
    --header 'Authorization: Bearer  Token' \
    --header 'Content-Type: application/json' \
    --data-raw 'jsonRequestBody'
    Hope this will help you. Make sure the service account has at least viewer permission to web API. If you are calling a process model from this webapi then that service account must have at least initiator permission for the process model.
Children