WEB API Giving 404 - Not Found Error

Certified Lead Developer

Hi All,

We have created a Web API which Starts a Process (Process generates a document and sends an email). I am trying to test the Web API Standalone it is working Fine, but if I am trying to hit the Web API link from Web Browser it is giving 404 error.

On the other hand if I have a Web API which generates a simple XML with User details using user() and trying to hit the same from Web Browser it is working perfectly fine.

I have given Admin rights to the web API and Process Model but no luck. If I am trying to call this WEB API Via Integration Object then also Getting 404 Error

Actual Use Case:

My actual use case is we need to expose a simple Appian process via Web API so that it can be accessible by anyone within the team to perform some tasks just by hitting the API without logging into the environment navigating to Actions tab and doing some action.

Additional Question regarding WEB API:

 - Is it possible to expose an Appian Process to anyone within the Organisation or outside the Organisation irrespective of the case that the initiator is available within Appian or not (Initiator's ID has been created or not in Appian).

 - Where we will give the authentication within the WEB API. Please find attached sample WEB API Code for the same.

with(
  a!startProcess(
    processModel: cons!TEST_AUDIT_PROCESS_MODEL,
    processParameters: a!fromJson(
      http!request.body
    ),
    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"
        }
      )
    )
  )
)

Thanks

  Discussion posts and replies are publicly visible

Parents
  • This is because a process can only be started in a HTTP POST operation and your API is listening for POST only. Calling the URL in a browser is a HTTP GET.
  • Hi Stefan,

    I have a Visual Studio script that is calling using an API call to login to the webserver to transfer file and I am getting a 404:Not Found error. I am not a programmer, but I am trying to help fix this problem as a sys admin. Appreciate any help on this. Since, I saw you said something about calling the URL in a browser is a HTTP GET statement, I thought whether it has any relevance for my case.

     

    Thanks and appreciate your response

    John

    <?xml version="1.0" encoding="utf-8"?>
    <configuration>
    <configSections>
    <section name="loggingConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.LoggingSettings, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.505.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="true" />
    <sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
    <section name="PolicyData.My.MySettings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
    <section name="company.Analytics.PolicyData.My.MySettings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
    </sectionGroup>
    <!-- For more information on Entity Framework configuration, visit go.microsoft.com/.../ -->
    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
    </configSections>
    <loggingConfiguration name="" tracingEnabled="true" defaultCategory="General">
    <listeners>
    <add name="Rolling Flat File Trace Listener" type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.RollingFlatFileTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.505.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.RollingFlatFileTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.505.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" fileName="..\IO\PolicyData.log" footer="" formatter="Text Formatter" header="" rollSizeKB="5000" maxArchivedFiles="5" />
    </listeners>
    <formatters>
    <add type="Microsoft.Practices.EnterpriseLibrary.Logging.Formatters.TextFormatter, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.505.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" template="{timestamp(local)} {message}" name="Text Formatter" />
    </formatters>
    <categorySources>
    <add switchValue="All" name="General">
    <listeners>
    <add name="Rolling Flat File Trace Listener" />
    </listeners>
    </add>
    </categorySources>
    <specialSources>
    <allEvents switchValue="All" name="All Events" />
    <notProcessed switchValue="All" name="Unprocessed Category" />
    <errors switchValue="All" name="Logging Errors &amp; Warnings">
    <listeners>
    <add name="Rolling Flat File Trace Listener" />
    </listeners>
    </errors>
    </specialSources>
    </loggingConfiguration>
    <connectionStrings>
    <add name="PD_CDB" connectionString="Data Source=db-pr-pd.company.com;Initial Catalog=BWCDB;uid=PDExternalAppsId;Password=password" />
    <add name="CLAIMSEntities" connectionString="metadata=res://*/ClaimsModel.csdl|res://*/ClaimsModel.ssdl|res://*/ClaimsModel.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=SQLCWSPROD;initial catalog=CLAIMS;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" />
    <add name="GenBusinessEntities" connectionString="metadata=res://*/GenBusinessModel.csdl|res://*/GenBusinessModel.ssdl|res://*/GenBusinessModel.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=db-pr-genbusiness.company.com;initial catalog=GenBusiness;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" />
    <add name="NLog" connectionString="Data Source=db-pr-appprog.company.com;Initial Catalog=ApplicationsProgramming;Trusted_Connection=True;" />
    </connectionStrings>
    <appSettings>
    <add key="PD_UserID" value="serviceaccount" />
    <add key="PD_Password" value="password" />
    <add key="PD_ClientID" value="14" />
    <add key="XMLManagerServiceURL" value="">prod-app-net/.../WSXMLMANAGERSERVICEEX.ASMX" />
    <add key="OutputPath" value="\\appfiles01.company.com\PROD\VENDORNAME\PolicyData\IO" />
    <add key="ArchivePath" value="\\appfiles01.company.com\PROD\VENDORNAME\PolicyData\IO\archive" />
    <add key="ErrorPath" value="\\appfiles01.company.com\PROD\VENDORNAME\PolicyData\IO\error" />
    <add key="ShareFolder" value="\\appfiles01.company.com\PROD\VENDORNAME\PolicyData\IO\Share" />
    <add key="DataFolder" value="\\appfiles01.company.com\PROD\VENDORNAME\PolicyData\IO\Data "/>
    <add key="InsuredFile" value="insured.psv" />
    <add key="TermFile" value="term.psv" />
    <add key="StateFile" value="state.psv" />
    <add key="ClassFile" value="class.psv" />
    <add key="ClaimFile" value="claim.psv" />
    <add key="ClaimDetailFile" value="claim_detail.psv" />
    <add key="ZippedFile" value="companyPolicyData.DEV.zip" />
    <add key="EmailHost" value="smtp.company.com" />
    <add key="EmailPort" value="25" />
    <add key="DateAuditsBeganInPD" value="2012-03-18" />
    <add key="VENDORNAMEWebServiceURI" value="">insureright.VENDORNAME.com/.../>
    <add key="VENDORNAMEUserId" value="test@company.com"/>
    <add key="VENDORNAMEPassword" value="password"/>
    <add key="UploadResponseFile" value="UploadResponse.txt"/>
    </appSettings>
    <system.diagnostics>
    <sources>
    <!-- This section defines the logging configuration for My.Application.Log -->
    <source name="DefaultSource" switchName="DefaultSwitch">
    <listeners>
    <add name="FileLog" />
    <!-- Uncomment the below section to write to the Application Event Log -->
    <!--<add name="EventLog"/>-->
    </listeners>
    </source>
    </sources>
    <switches>
    <add name="DefaultSwitch" value="Information" />
    </switches>
    <sharedListeners>
    <add name="FileLog" type="Microsoft.VisualBasic.Logging.FileLogTraceListener, Microsoft.VisualBasic, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" initializeData="FileLogWriter" />
    <!-- Uncomment the below section and replace APPLICATION_NAME with the name of your application to write to the Application Event Log -->
    <!--<add name="EventLog" type="System.Diagnostics.EventLogTraceListener" initializeData="APPLICATION_NAME"/> -->
    </sharedListeners>
    </system.diagnostics>
    <system.serviceModel>
    <bindings>
    <wsHttpBinding>
    <binding name="BasicHttpEndpoint">
    <security mode="Transport" />
    </binding>
    <binding name="WSHttpBinding_ICommon">
    <security mode="Transport" />
    </binding>
    <binding name="WSHttpBinding_IBranding">
    <security mode="Transport" />
    </binding>
    </wsHttpBinding>
    </bindings>
    <client>
    <endpoint address="">agencyservices.company.com/companyBiz.svc" binding="wsHttpBinding" bindingConfiguration="BasicHttpEndpoint" contract="AgencyService.IcompanyBiz" name="BasicHttpEndpoint" />
    <endpoint address="">commonservices.company.com/Common.svc" binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_ICommon" contract="CommonService.ICommon" name="WSHttpBinding_ICommon" />
    <endpoint address="">commonservices.company.com/Branding.svc" binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IBranding" contract="BrandService.IBranding" name="WSHttpBinding_IBranding" />
    </client>
    </system.serviceModel>
    <applicationSettings>
    <PolicyData.My.MySettings>
    <setting name="PolicyGapData_XMLManagerServiceEx_WSXMLManagerServiceEx" serializeAs="String">
    <value>tst-iisapp-net/.../value>
    </setting>
    </PolicyData.My.MySettings>
    </applicationSettings>
    <startup>
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
    </startup>
    <entityFramework>
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
    <parameters>
    <parameter value="mssqllocaldb" />
    </parameters>
    </defaultConnectionFactory>
    <providers>
    <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
    </providers>
    </entityFramework>
    </configuration>

  • I need more details about what you are trying to achieve. What is the XML about?

  • We are trying to compile some files and zip it and then upload it to a vendor site. The vendor is Valen Analytics. We are calling this program through a scheduled task to be run every month. The server the scheduled task runs is a Windows Server 2012 R2. This program is supposed to compile or gather all the files and we are uploading it to the vendor site. They have provided us a URL which is in the code and a userID and password. The file is zipped and stored in our network file share and from there it is supposed to upload it to their site using this link below with the userid and password that they have provided. Hope this helps!

     <add key="VENDORNAMEWebServiceURI" value="https://insureright.VENDORNAME.com/api/2/batch/profile"/>

  • This helps a bit. Which part is implemented in Appian?

Reply Children
No Data