See doc on this aspect here
https://www.ibm.com/docs/en/zos-connect/zosconnect/3.0?topic=apis-sample-specifying-values-arrays-stringsCheck your program is setting length and value for the variable you want to have sent on the outbound URL
Here is another example of setting lng and value
Move 10 to item of InqCat-Request.
Move 2 to item-length of InqCat-Request
Your program would need to have something like this as an example
Move 2 to bpId2-length
Move "123" to bpId2
If still have issues, you could try trace in CICS, see
https://www.ibm.com/docs/en/zos-connect/zosconnect/3.0?topic=problems-enabling-trace-in-communication-stubscould also trace in zCEE server using
https://www.ibm.com/docs/en/zos-connect/zosconnect/3.0?topic=problems-enabling-trace-in-zos-connectAPI requester:
zosConnectApiRequester=allIf your company has IBM support for zOS Connect, you could also open a case.
There are zCEE API examples here
https://github.com/ibm-wsc/zCONNEE-Wildfire-Workshop/tree/master/OpenAPI2The code for a COBOL program doing API call can be found here:
https://github.com/ibm-wsc/zCONNEE-Wildfire-Workshop/blob/master/cobol/POSTAPIsee the code under the comment - Set up the data for the API Requester call
Also in your URL you have
/CustomerHistory/api/changehistory/postFieldChanges
If you showed this URL to an API architect, they would probably say this is not an ideal URL structure for an API.
From the URL, the intent seems to be that you want to send info about some field changes to an external server.
Having the string post in postFieldChanges is redundant, as you are doing a POST.
See
https://restfulapi.net/http-methods/which says
Use POST APIs to create new subordinate resources
Use PUT APIs primarily to update an existing resource
Since intent seems to be that you want to change some data, you should be doing a PUT request, and since a PUT means the API is doing a change, there is no need to have the word post in the URL string
Then in the URL you also have - changehistory
This is also redundant, since if you do a PUT request, that implies you are doing a change/update, so again no need to have the word change in the URL
The api in the URL is probably also redundant, since you are doing an API
It may be that the URL and POST method you are using is what you have to use because that is the API that the server you are calling provides, in which case you will have to use the API structure and HTTP method they provide.
------------------------------
Edward McCarthy
WAS on System z
------------------------------
Original Message:
Sent: Fri August 12, 2022 03:19 PM
From: garrett shaw
Subject: Creating URL with a variable
Hello,
We are creating a Requestor call to a windows server. One of the directories in the URL is a variable that we are trying to set via a program.
The example of a working example is /CustomerHistory/api/changehistory/postFieldChanges/ bpid=000028477 but when we execute the program we get /CustomerHistory/api/changehistory/postFieldChanges . The variable does not resolve. I have included the copybooks from the program, is there anything special that needs to be done to populate a variable in the URL or what? Is there a better way to generate a URL? If I can provide more information, please let me know that also. Below are the copybooks involved.
Thanks
Garrett
This is the API info Copybook
03 BAQ-APINAME PIC X(255)
VALUE 'BusinessPartner.WebApi.CustomerHistory_v1'.
03 BAQ-APINAME-LEN PIC S9(9) COMP-5 SYNC
VALUE 41.
03 BAQ-APIPATH PIC X(255)
VALUE '%2FCustomerHistory%2Fapi%2Fchangehistory%2FpostFiel
- 'dChanges'.
03 BAQ-APIPATH-LEN PIC S9(9) COMP-5 SYNC
VALUE 59.
03 BAQ-APIMETHOD PIC X(255)
VALUE 'POST'.
03 BAQ-APIMETHOD-LEN PIC S9(9) COMP-5 SYNC
VALUE 4.
This is the Request structure copybook
* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
* This file contains the generated language structure(s) for
* request JSON schema
* 'CustomerHistory_api_changehist_1_request.json'.
* This structure was generated using 'DFHJS2LS' at mapping level
* '4.3'.
*
*
* 06 ReqQueryParameters.
*
*
* JSON schema keyword 'ReqQueryParameters->bpId' is optional.
* The number of instances present is indicated in field
* 'bpId-num'.
* There should be at least '0' instance(s).
* There should be at most '1' instance(s).
* 09 bpId-num PIC S9(9) COMP-5 SYNC.
*
*
* 09 bpId.
*
* Comments for field 'bpId2':
* This field represents the value of JSON schema keyword
* 'ReqQueryParameters->bpId'.
* JSON schema type: 'string'.
* This field contains a varying length array of characters or
* binary data.
* 12 bpId2-length PIC S9999 COMP-5
* SYNC.
* 12 bpId2 PIC X(255).
*
*
* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
06 ReqQueryParameters.
09 bpId-num PIC S9(9) COMP-5 SYNC.
09 bpId.
12 bpId2-length PIC S9999 COMP-5
SYNC.
12 bpId2 PIC X(255).
------------------------------
Garrett Shaw
Sr System Programmer
Ingram
La Vergne TN
404-964-2032
------------------------------