Expose and API from Appian

Hi All,

  Can anyone help me on, is it possible we can expose an API from Appian Side, which can be accessed by SAP ,

and when the Api is called from SAP side, a Process model will trigger with details.

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Lead Developer

    In Appian, when you create a new web api object, this is one of the available templates. Takes about 5 clicks. Did you try this?

  • Hi Stefan/Acacio,

      I have implemented the Mapping to CDT with API Body, but getting the below error, can you please help me out with the same,

      Not a valid Web API Response. Received: [Lcom.appiancorp.core.expr.reaction.ReactionTree;@2617a999.

    Internal Server Error on REST API invocation.
    com.appiancorp.exceptions.LocalizedAppianRuntimeException$LocalizedAppianException: Contact your application administrator for help resolving this issue. Provide them with the following issue identifier: IV82KT3W (APNX-1-4533-000)

    a!localVariables(
      local!jsondata : a!fromJson(
        http!request.body
      ),
      local!cdtdata : a!forEach(items: local!jsondata, expression:{'type!{urn:com:appian:types}PF_Request'(
        requestId: fv!item[fv!index].requestId, 
        destinationCountryID: fv!item[fv!index].destinationCountryID,
        frieghtCurrencyID: fv!item[fv!index].frieghtCurrencyID,
        GBEID: fv!item[fv!index].GBEID,
        LID: fv!item[fv!index].LID,
        LOBID: fv!item[fv!index].LOBID,
        leadSupplyLocationID: fv!item[fv!index].leadSupplyLocationID,
        originCountryID: fv!item[fv!index].originCountryID,
        processID: fv!item[fv!index].processID,
        reasonCodeID: fv!item[fv!index].reasonCodeID,
        regionID: fv!item[fv!index].regionID, 
        rootCauseID: fv!item[fv!index].rootCauseID,
        routingMethodID: fv!item[fv!index].routingMethodID,
        shipmentDirectionID: fv!item[fv!index].shipmentDirectionID,
        shipmentWidth: fv!item[fv!index].shipmentWidth,
        shipperID: fv!item[fv!index].shipperID,
        approvalLevels: fv!item[fv!index].approvalLevels,
        approvalLevelsCompleted: fv!item[fv!index].approvalLevelsCompleted,
        correctiveActionReason: fv!item[fv!index].correctiveActionReason,
        destionationCustomerSupplier: fv!item[fv!index].destionationCustomerSupplier,
        destinationSiteID: fv!item[fv!index].destinationSiteID, 
        fGPartNumber: fv!item[fv!index].fGPartNumber,
        freightCost: fv!item[fv!index].freightCost,
        isFreightRecoverable: fv!item[fv!index].isFreightRecoverable,
        isWeightKnown: fv!item[fv!index].isWeightKnown,
        originCustomerSupplier: fv!item[fv!index].originCustomerSupplier,
        originSiteID: fv!item[fv!index].originSiteID,
        originStateId: fv!item[fv!index].originStateId,
        otherRoutingMethod: fv!item[fv!index].otherRoutingMethod,
        otherShipper: fv!item[fv!index].otherShipper,  
        partNumber: fv!item[fv!index].partNumber, 
        projectNumber: fv!item[fv!index].projectNumber,
        purchaseOrder: fv!item[fv!index].purchaseOrder,
        requestDt: fv!item[fv!index].requestDt,
        requestor: fv!item[fv!index].requestor,
        requiredShipDate: fv!item[fv!index].requiredShipDate,
        revenueAtRisk: fv!item[fv!index].revenueAtRisk,
        rootCauseReason: fv!item[fv!index].rootCauseReason,
        ShipmentHeight: fv!item[fv!index].ShipmentHeight,
        ShipmentLength: fv!item[fv!index].ShipmentLength,
        ShipmentUnits: fv!item[fv!index].ShipmentUnits, 
        ShipmentWeight: fv!item[fv!index].ShipmentWeight,
        ShipperEmail: fv!item[fv!index].ShipperEmail,
        Status: fv!item[fv!index].Status,
        TotalCost: fv!item[fv!index].TotalCost,
        USFreightCost: fv!item[fv!index].USFreightCost,
        WaybillNumber: fv!item[fv!index].WaybillNumber,
        OriginSite: fv!item[fv!index].OriginSite,
        DestinationSite: fv!item[fv!index].DestinationSite,
        /*CompletedOn: fv!item[fv!index].CompletedOn,*/
        ActualFreightCost: fv!item[fv!index].ActualFreightCost,
        FreightRiskPercent: fv!item[fv!index].FreightRiskPercent,
        
      )
      
      }
      ),
      
      {
        
        a!startProcess(
          processModel: cons!Test_Email_WebAPI,
          processParameters: {
            PF_Request : local!cdtdata
          },
          onSuccess: a!httpResponse(
            statusCode: 200,
            headers: {
              a!httpHeader(name: "Content-Type", value: "application/json")
            },
            body: a!toJson(
              fv!processInfo
            )
          ),
          onError: a!httpResponse(
            statusCode: 500,
            headers: {
              a!httpHeader(name: "Content-Type", value: "application/json")
            },
            body: a!toJson(
              {
                error: "There was an error starting the process"
              }
            )
          )
        )
      }
      
    )
    

Reply
  • Hi Stefan/Acacio,

      I have implemented the Mapping to CDT with API Body, but getting the below error, can you please help me out with the same,

      Not a valid Web API Response. Received: [Lcom.appiancorp.core.expr.reaction.ReactionTree;@2617a999.

    Internal Server Error on REST API invocation.
    com.appiancorp.exceptions.LocalizedAppianRuntimeException$LocalizedAppianException: Contact your application administrator for help resolving this issue. Provide them with the following issue identifier: IV82KT3W (APNX-1-4533-000)

    a!localVariables(
      local!jsondata : a!fromJson(
        http!request.body
      ),
      local!cdtdata : a!forEach(items: local!jsondata, expression:{'type!{urn:com:appian:types}PF_Request'(
        requestId: fv!item[fv!index].requestId, 
        destinationCountryID: fv!item[fv!index].destinationCountryID,
        frieghtCurrencyID: fv!item[fv!index].frieghtCurrencyID,
        GBEID: fv!item[fv!index].GBEID,
        LID: fv!item[fv!index].LID,
        LOBID: fv!item[fv!index].LOBID,
        leadSupplyLocationID: fv!item[fv!index].leadSupplyLocationID,
        originCountryID: fv!item[fv!index].originCountryID,
        processID: fv!item[fv!index].processID,
        reasonCodeID: fv!item[fv!index].reasonCodeID,
        regionID: fv!item[fv!index].regionID, 
        rootCauseID: fv!item[fv!index].rootCauseID,
        routingMethodID: fv!item[fv!index].routingMethodID,
        shipmentDirectionID: fv!item[fv!index].shipmentDirectionID,
        shipmentWidth: fv!item[fv!index].shipmentWidth,
        shipperID: fv!item[fv!index].shipperID,
        approvalLevels: fv!item[fv!index].approvalLevels,
        approvalLevelsCompleted: fv!item[fv!index].approvalLevelsCompleted,
        correctiveActionReason: fv!item[fv!index].correctiveActionReason,
        destionationCustomerSupplier: fv!item[fv!index].destionationCustomerSupplier,
        destinationSiteID: fv!item[fv!index].destinationSiteID, 
        fGPartNumber: fv!item[fv!index].fGPartNumber,
        freightCost: fv!item[fv!index].freightCost,
        isFreightRecoverable: fv!item[fv!index].isFreightRecoverable,
        isWeightKnown: fv!item[fv!index].isWeightKnown,
        originCustomerSupplier: fv!item[fv!index].originCustomerSupplier,
        originSiteID: fv!item[fv!index].originSiteID,
        originStateId: fv!item[fv!index].originStateId,
        otherRoutingMethod: fv!item[fv!index].otherRoutingMethod,
        otherShipper: fv!item[fv!index].otherShipper,  
        partNumber: fv!item[fv!index].partNumber, 
        projectNumber: fv!item[fv!index].projectNumber,
        purchaseOrder: fv!item[fv!index].purchaseOrder,
        requestDt: fv!item[fv!index].requestDt,
        requestor: fv!item[fv!index].requestor,
        requiredShipDate: fv!item[fv!index].requiredShipDate,
        revenueAtRisk: fv!item[fv!index].revenueAtRisk,
        rootCauseReason: fv!item[fv!index].rootCauseReason,
        ShipmentHeight: fv!item[fv!index].ShipmentHeight,
        ShipmentLength: fv!item[fv!index].ShipmentLength,
        ShipmentUnits: fv!item[fv!index].ShipmentUnits, 
        ShipmentWeight: fv!item[fv!index].ShipmentWeight,
        ShipperEmail: fv!item[fv!index].ShipperEmail,
        Status: fv!item[fv!index].Status,
        TotalCost: fv!item[fv!index].TotalCost,
        USFreightCost: fv!item[fv!index].USFreightCost,
        WaybillNumber: fv!item[fv!index].WaybillNumber,
        OriginSite: fv!item[fv!index].OriginSite,
        DestinationSite: fv!item[fv!index].DestinationSite,
        /*CompletedOn: fv!item[fv!index].CompletedOn,*/
        ActualFreightCost: fv!item[fv!index].ActualFreightCost,
        FreightRiskPercent: fv!item[fv!index].FreightRiskPercent,
        
      )
      
      }
      ),
      
      {
        
        a!startProcess(
          processModel: cons!Test_Email_WebAPI,
          processParameters: {
            PF_Request : local!cdtdata
          },
          onSuccess: a!httpResponse(
            statusCode: 200,
            headers: {
              a!httpHeader(name: "Content-Type", value: "application/json")
            },
            body: a!toJson(
              fv!processInfo
            )
          ),
          onError: a!httpResponse(
            statusCode: 500,
            headers: {
              a!httpHeader(name: "Content-Type", value: "application/json")
            },
            body: a!toJson(
              {
                error: "There was an error starting the process"
              }
            )
          )
        )
      }
      
    )
    

Children