Web Service Issue

"(WalzCraft) Jerry Forss" <[email protected]> Thu, 8 May 2025 14:33:53 +0000
Newsgroups gmane.comp.systems.as400.web
Message-ID <[email protected]>
Cross posting from Midrange.

I really want to do this the right way.  I have done several services that I only pass 2 parameters.
The latest one is for maintenance so the number of parameters has increased.
As I move forward there will be more services that will require a LOT more parameters so I hope I can use json as input.

Is there a way to send the additional fields in a json or do they always need to be in the URL?

I am not sure what I am doing wrong.  I need to get this working asap and would GREATLY appreciate any guidance.

URL I am calling. Fails with a 404 not found.

http://MyIP:MyPort/web/services/Contact_Maintenance/AA/780/0/ADD/Me/MAS/Master/123-456-7890/1234/123-456-7890/Email.com

Here is the input parameters in the RPG.

Dcl-pr WOMConMntR;
  Envir                      Char(2);
  CustNo                     Packed(8 : 0);
  Seq                        Packed(5 : 0);
  Action                     Char(3);
  Name                       Char(30);
  Type                       Char(3);
  Title                      Char(25);
  Phone                      Char(12);
  PhoneExt                   Char(4);
  Fax                        Char(12);
  EMail                      Char(50);
  Fail                       Char(100);
End-pr;

Dcl-pi WOMConMntR;
  Envir                      Char(2);
  CustNo                     Packed(8 : 0);
  Seq                        Packed(5 : 0);
  Action                     Char(3);
  Name                       Char(30);
  Type                       Char(3);
  Title                      Char(25);
  Phone                      Char(12);
  PhoneExt                   Char(4);
  Fax                        Char(12);
  EMail                      Char(50);
  Fail                       Char(100);
End-pi;

Pcml from Contact_Maintenance

<pcml
    restUriPathTemplate="/{envir:\w+}/{custno:\d+}/{seq:\d+}/{action:\w+}/{name:\w+}/{type:\w+}/{title:\w+}/{phone:\w+}/{phoneext:\w+}/{fax:\w+}/{email:\w+}" version="7.0">
    <program errormessage="" httpheaders="*NONE" httpstatusonfailure="500" httpstatusonsuccess="200"
        inputWrapperIdentifier="WOMCONMNTRInput" name="WOMCONMNTR" outputWrapperIdentifier="WOMCONMNTRResult"
        parseorder="CUSTNO SEQ FAIL" path="/QSYS.LIB/UTILITIES.LIB/WOMCONMNTR.PGM" restConsumes="*/*"
        restHttpRequestMethod="POST" restProduces="application/json" threadsafe="false" trimmode="*TRAILING"
        wrapInputParams="false" wrapOutputParam="true">
        <data length="2" name="ENVIR" restInPathParam="envir" type="char" usage="input"/>
        <data length="8" name="CUSTNO" precision="0" restInPathParam="custno" type="packed" usage="inputoutput"/>
        <data length="5" name="SEQ" precision="0" restInPathParam="seq" type="packed" usage="inputoutput"/>
        <data length="3" name="ACTION" restInPathParam="action" type="char" usage="input"/>
        <data length="30" name="NAME" restInPathParam="name" type="char" usage="input"/>
        <data length="3" name="TYPE" restInPathParam="type" type="char" usage="input"/>
        <data length="25" name="TITLE" restInPathParam="title" type="char" usage="input"/>
        <data length="12" name="PHONE" restInPathParam="phone" type="char" usage="input"/>
        <data length="4" name="PHONEEXT" restInPathParam="phoneext" type="char" usage="input"/>
        <data length="12" name="FAX" restInPathParam="fax" type="char" usage="input"/>
        <data length="50" name="EMAIL" restInPathParam="email" type="char" usage="input"/>
        <data length="100" name="FAIL" type="char" usage="output"/>
    </program>
</pcml>

Swagger

{
  "swagger": "2.0",
  "info": {
    "title": "Contact_Maintenance APIs",
    "description": "APIs available for Contact_Maintenance",
    "version": "1.0.0"
  },
  "host": "MyIP:MyPort",
  "schemes": [ "http" ],
  "basePath": "/web/services/Contact_Maintenance",
  "tags": [
    {
      "name": "Contact_Maintenance APIs",
      "description": "APIs available for Contact_Maintenance"
    }
  ],
  "definitions": {
    "WOMCONMNTRResult": {
      "type": "object",
      "properties": {
        "CUSTNO": {
          "type": "number"
        },
        "SEQ": {
          "type": "number"
        },
        "FAIL": {
          "type": "string",
          "maxLength": 100
        }
      }
    }
  },
  "paths": {
    "/{envir}/{custno}/{seq}/{action}/{name}/{type}/{title}/{phone}/{phoneext}/{fax}/{email}": {
      "post": {
        "tags": [
          "Contact_Maintenance APIs"
       ],
        "operationId": "WOMCONMNTR",
        "consumes": [
          "*/*"
        ],
        "produces": [
          "application/json"
        ],
        "parameters": [
          {
            "name": "envir",
            "in": "path",
            "required": true,
            "type": "string",
            "pattern": "\\w+<file://w+>",
            "maxLength": 2
          },
          {
            "name": "custno",
            "in": "path",
            "required": true,
            "type": "number",
            "pattern": "\\d+<file://d+>"
          },
          {
            "name": "seq",
            "in": "path",
            "required": true,
            "type": "number",
            "pattern": "\\d+<file://d+>"
          },
          {
            "name": "action",
            "in": "path",
            "required": true,
            "type": "string",
            "pattern": "\\w+<file://w+>",
            "maxLength": 3
          },
          {
            "name": "name",
            "in": "path",
            "required": true,
            "type": "string",
            "pattern": "\\w+<file://w+>",
            "maxLength": 30
          },
          {
            "name": "type",
            "in": "path",
            "required": true,
            "type": "string",
            "pattern": "\\w+<file://w+>",
            "maxLength": 3
          },
          {
            "name": "title",
            "in": "path",
            "required": true,
            "type": "string",
            "pattern": "\\w+<file://w+>",
            "maxLength": 25
          },
          {
            "name": "phone",
            "in": "path",
            "required": true,
            "type": "string",
            "pattern": "\\w+<file://w+>",
            "maxLength": 12
          },
          {
            "name": "phoneext",
            "in": "path",
            "required": true,
            "type": "string",
            "pattern": "\\w+<file://w+>",
            "maxLength": 4
          },
          {
            "name": "fax",
            "in": "path",
            "required": true,
            "type": "string",
            "pattern": "\\w+<file://w+>",
            "maxLength": 12
          },
          {
            "name": "email",
            "in": "path",
            "required": true,
            "type": "string",
            "pattern": "\\w+<file://w+>",
            "maxLength": 50
          }
        ],
        "responses": {
          "200": {
            "description": "Successful operation",
            "schema": {
              "$ref": "#/definitions/WOMCONMNTRResult"
            }
          },
          "500": {
            "description": "Unexpected exception"
          }
        }
      }
    }
  }
}





Subject to Change Notice:

WalzCraft reserves the right to improve designs, and to change specifications without notice.

Confidentiality Notice:

This message and any attachments may contain confidential and privileged information that is protected by law. The information contained herein is transmitted for the sole use of the intended recipient(s) and should "only" pertain to "WalzCraft" company matters. If you are not the intended recipient or designated agent of the recipient of such information, you are hereby notified that any use, dissemination, copying or retention of this email or the information contained herein is strictly prohibited and may subject you to penalties under federal and/or state law. If you received this email in error, please notify the sender immediately and permanently delete this email. Thank You

WalzCraft PO Box 1748 La Crosse, WI, 54602-1748
www.walzcraft.com<http://www.walzcraft.com> Phone: 1-800-237-1326
-- 
This is the Web Enabling the IBM i (AS/400 and iSeries) (WEB400) mailing list
To post a message email: [email protected]
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/web400
or email: [email protected]
Before posting, please take a moment to review the archives
at https://archive.midrange.com/web400.