Search found 30 matches

by jan
Mon Jun 16, 2025 5:58 pm
Forum: Questions & Answers
Topic: REST API Endpoints with optional authentication
Replies: 2
Views: 171912

Re: REST API Endpoints with optional authentication

Thanks for the response!

I agree with not using it if majority of the APIs will just have to set it to be ignored.

I'm gonna look into private header fields as that seems like a great idea for what we're trying to do.
by jan
Wed May 28, 2025 5:13 pm
Forum: Questions & Answers
Topic: REST API Endpoints with optional authentication
Replies: 2
Views: 171912

REST API Endpoints with optional authentication

Good day,

I'm looking for opinions on how to deal with the REST API endpoint authentication in a scenario where it would require JWT validation if a user is logged in, and it would not if they are not logged in.

The few ways I could think of this working is either by:

- Setting Ignore Top Level ...
by jan
Fri Mar 21, 2025 5:49 pm
Forum: Questions & Answers
Topic: Line Feeds in Strings to be Hashed
Replies: 1
Views: 35403

Re: Line Feeds in Strings to be Hashed

Weirdly, I got it working in a WAM using the code below.

#xNoteSubject := 'host: apitest.cybersource.com' + (10).AsUnicodeString
#xNoteSubject += 'date: Fri, 21 Mar 2025 04:32:08 GMT' + (10).AsUnicodeString
#xNoteSubject += 'request-target: post /pts/v2/payments/' + (10).AsUnicodeString ...
by jan
Fri Mar 21, 2025 5:21 pm
Forum: Questions & Answers
Topic: Line Feeds in Strings to be Hashed
Replies: 1
Views: 35403

Line Feeds in Strings to be Hashed

Good day!

I am working on consuming some REST APIs and am having trouble getting the hashing algorithm to work properly when Line Feeds are involved.

The hashing uses SHA-256 HMAC with the output encoding as Base64. This is the string in the sample provided by the REST API documentation.

host ...
by jan
Thu Oct 10, 2024 3:21 pm
Forum: Questions & Answers
Topic: REST API Response with custom JSON String containing invalid characters when ran in the IBMi
Replies: 5
Views: 22167

Re: REST API Response with custom JSON String containing invalid characters when ran in the IBMi

Thanks for the response @MarkD.

I did try this with the JSON shown below. The response is too large to post here so I put it up as a .txt file.


{
"days": [
{
"ABC123": "ABC123"
}
]
}


https://drive.google.com/file/d/1LcmktKpRTiddVxmiHh-yjU_64yN313he/view?usp=sharing

The response isn't ...
by jan
Wed Oct 09, 2024 6:41 pm
Forum: Questions & Answers
Topic: REST API Response with custom JSON String containing invalid characters when ran in the IBMi
Replies: 5
Views: 22167

Re: REST API Response with custom JSON String containing invalid characters when ran in the IBMi

Hi @Dino,

Thank you for the response. I've actually done the sample you did in another API as I'm new in learning about the construction of Server Modules as REST APIs.

The current one with issues is actually for a list of categories and sub-categories. Sub-categories will have the same fields as ...
by jan
Tue Oct 08, 2024 12:54 pm
Forum: Questions & Answers
Topic: REST API Response with custom JSON String containing invalid characters when ran in the IBMi
Replies: 5
Views: 22167

REST API Response with custom JSON String containing invalid characters when ran in the IBMi

Good day,

I've encountered an issue that only happens when running REST APIs in the IBMi with the response being a custom JSON string.

https://i.imgur.com/IjbRsVT.png


#uContext.Response.HttpStatus := 200
#uContext.Response.ContentType := "application/json"
#uContext.Response.ContentString ...
by jan
Tue Aug 27, 2024 12:08 pm
Forum: Questions & Answers
Topic: LANSA REST API Persistent Fields
Replies: 4
Views: 18154

Re: LANSA REST API Persistent Fields

Thanks for the advice Brendan! The cryptographically secure string does seem more secure and sensible to use.
by jan
Wed Aug 21, 2024 10:49 am
Forum: Questions & Answers
Topic: LANSA REST API Persistent Fields
Replies: 4
Views: 18154

Re: LANSA REST API Persistent Fields

Thanks for verifying the persistence in REST APIs Brendan!

With regards to the GUID, is it good practice to use the system variable *GUID or *GUID_DB to serve as the key to a table that will help track down persistent values?
by jan
Mon Aug 19, 2024 3:32 pm
Forum: Questions & Answers
Topic: LANSA REST API Persistent Fields
Replies: 4
Views: 18154

LANSA REST API Persistent Fields

Hi,

I'm getting around the concept of LANSA REST APIs now but noticed that there was nothing in the available documentation that mentioned Session Management anymore. I guess this has been superseded by using JWT Tokens at this stage.

How can one persist a value over the server-side for REST APIs ...
by jan
Tue Oct 20, 2020 2:37 pm
Forum: Questions & Answers
Topic: Messages not appearing after calling an RP
Replies: 1
Views: 42663

Messages not appearing after calling an RP

Good day. I have a WAM that calls an RP with the definition inside a method routine:


Mthroutine Name(umCheckShipToRDI) Desc('Check Ship To RDI')

Define_Map For(*OUTPUT) Class(#PRIM_ALPH) Name(#oRDI)

Define_Com Class(#RP_GETRDI) Name(#RP_GetRDI)


We got a report that some validation messages ...
by jan
Tue Mar 17, 2020 1:25 pm
Forum: Questions & Answers
Topic: Reading a large set of JSON data
Replies: 3
Views: 33265

Re: Reading a large set of JSON data

Thanks for the response. Apparently, the team has agreed to just limit the searches to 100 for now so we will keep using the current implementation to move things forward.

On the other hand, I could not find any examples on how to use XPRIM_JSONReader. Would there be any examples of this in the ...
by jan
Mon Mar 16, 2020 11:54 pm
Forum: Questions & Answers
Topic: Reading a large set of JSON data
Replies: 3
Views: 33265

Reading a large set of JSON data

Hi Everyone,

I asked a question previously on how to efficiently read JSON data which @Marcus Lancaster was able to provide a solution for.

Now, our team is working on a large set of data with about 500 entries returned and a kind of complicated structure (see a trimmed down version below ...
by jan
Tue Feb 18, 2020 1:18 pm
Forum: Questions & Answers
Topic: WAMs - Reading JSON data
Replies: 4
Views: 17820

Re: WAMs - Reading JSON data

Thanks for this Marcus. Very interesting as I have never used JSONDocument or JSONMember before.

I'll definitely give this a shot when an opportunity arrives.
by jan
Thu Feb 13, 2020 5:25 pm
Forum: Questions & Answers
Topic: WAMs - Reading JSON data
Replies: 4
Views: 17820

Re: WAMs - Reading JSON data

Hi Marcus,

Yes I was able to solve it but the solution might not be so efficient. Here is the code I used below:

#JsonRandomAccessReader.SetSourceHttpResponse Httpresponse(#HttpRequest.Response) Errorinfo(#JsonErrorInfo)

If Cond(#JsonErrorInfo.OK)

#FXRETCD := 'NR' /* Set to no parts found ...
by jan
Thu Jan 09, 2020 9:31 pm
Forum: Questions & Answers
Topic: WAMs - Reading JSON data
Replies: 4
Views: 17820

WAMs - Reading JSON data

Good day,

I have an HttpRequest that responds with a JSON object that looks like this:


{
"searchid": "4",
"squishvin": null,
"year": "2016",
"make": "Cadillac",
"model": "CT6",
"body": null,
"helptip": null,
"meta": null,
"parts": [
{
"id": "2539",
"part_number": "DW02305",
"glass ...
by jan
Thu Aug 15, 2019 9:19 am
Forum: Questions & Answers
Topic: Sorting PRIM_LCOL (RESOLVED)
Replies: 7
Views: 34318

Re: Sorting PRIM_LCOL

Hi Mark.

That is something I have never used nor was aware of. Seems to be an interesting concept.

I am just unsure if that would work while utilizing *ListFields. Ideally, I would have just sorted the LCOL but Sort_List only seems to work for Working Lists. Maybe I will give this a try sometime ...
by jan
Tue Aug 13, 2019 5:11 pm
Forum: Questions & Answers
Topic: Sorting PRIM_LCOL (RESOLVED)
Replies: 7
Views: 34318

Re: Sorting PRIM_LCOL

Thanks again for the response Stewart.

I've never tried sorting Keyed Collections before. Do you mean to create a keyed collection keyed by the field I want to sort on? For example PRIM_KCOL<#Price #RP> Or PRIM_KCOL<#Product #RP>?

Unfortunately, I am a bit tight with my schedule right now so I ...
by jan
Tue Aug 13, 2019 9:37 am
Forum: Questions & Answers
Topic: Sorting PRIM_LCOL (RESOLVED)
Replies: 7
Views: 34318

Re: Sorting PRIM_LCOL

Hi Stewart. Thanks for the response.

The way I display the list is by having all the data lie in a collection in a data model RP. Then the displayed list is controlled by pagination controls (page numbers, sorting, etc.) and gets only the data it needs to display from the data model depending on ...
by jan
Mon Aug 12, 2019 4:52 pm
Forum: Questions & Answers
Topic: Sorting PRIM_LCOL (RESOLVED)
Replies: 7
Views: 34318

Sorting PRIM_LCOL (RESOLVED)

Hi,

I am working with a List Collection inside a Reusable Part that acts as a data model shared between components. There is a particular list that can be controlled by a Sort control in one of the Views I am displaying.

Using the Sort_List over the property of the List Collection ends up with ...