Chilkat JSON Object

This forum is for eXpress++ general support.
Message
Author
skiman
Posts: 1185
Joined: Thu Jan 28, 2010 1:22 am
Location: Sijsele, Belgium
Contact:

Re: Chilkat JSON Object

#11 Post by skiman »

Hi,

I suppose you will need basic authentication.
See https://en.wikipedia.org/wiki/Basic_acc ... entication

You can do this by creating a cHeader := ... and send it with the loadurl as header parameter.

cHeader:= "Authorization: Basic "+ xbBase64Encode(cLogin+":"+cPassword)
Best regards,

Chris.
www.aboservice.be

User avatar
Tom
Posts: 1170
Joined: Thu Jan 28, 2010 12:59 am
Location: Berlin, Germany

Re: Chilkat JSON Object

#12 Post by Tom »

If the provider of the service has a Postman colletion or a Swagger collection for the API, you can use that directly to generate code with the Chilkat online tools. Just export the postman colllection if you have, reimport to Chilkat and create your code, including authentication and all the rest. Or maybe check the online samples for RESTful services, including all the authentication variants. But, at least, you need a good documentation from the service provider. Most of them have Swagger or Postman collections. Besides, Postman is a great tool to test those APIs.
Best regards,
Tom

"Did I offend you?"
"No."
"Okay, give me a second chance."

User avatar
unixkd
Posts: 565
Joined: Thu Feb 11, 2010 1:39 pm

Re: Chilkat JSON Object

#13 Post by unixkd »

Hi Tom

Thanks for your response

Chilkat has Http:PostJson2() with a simple example which I think should be easier to use.

I tried it and now I am getting error 404: The requested resource could not be found but may be available again in the future.

Any clue

Joe.

User avatar
unixkd
Posts: 565
Joined: Thu Feb 11, 2010 1:39 pm

Re: Chilkat JSON Object

#14 Post by unixkd »

Hi Tom

This is the detailed session log from my request.


---- Sending ----
POST /mapi/1/sessions/cenima-test/pepperoni-lekki202301 HTTP/1.1
Host: uat1.numero.co
Accept: */*
Accept-Encoding: UTF-8
Content-Type: application/json
Content-Length: 1488
Content-Encoding: identity
Authorization: Basic Y2VuaW1hLXRlc3Q6Q2VuaW1hVGVzdA==

{
"theatre": {
"name": "Megaplex",
"address": "5 Adeiran Ogunsanya Street, Lekki, Lagos Nigeria",
"timezone": "GMT+1"
},
"sessions": [
{
"sessionId": "sessionIdOne",
"sessionTime": "2023-06-07T20:22:00",
"timezone": "GMT+1",
"screen": "Gold Class 3",
"screenNumber": 7,
"screenCapacity": 250,
"film": {
"id": "someIdaFilmId",
"name": "Some Film",
"movieXchangeId": "e98de96d-9f47-47bf-b345-a880eb711caa",
"maccsboxFilmId": "1011.140",
"distributorId": "45",
"distributorName": "Paramount"
},
"details": {
"displayFormat": "3D,IMAX",
"duration": 150,
"languages": [
"EN"
],
"subtitles": [
"DE"
],
"soundFormat": "THX",
"seating": "4DX",
"showType": "01"
},
"salesByTicketType": [
{
"ticketType": "adult",
"ticketPrice": 51250,
"admits": 550,
"complimentaryAdmits": 17,
"revenueGross": 689750,
"revenueNet": 459000,
"tax": 97500
},
{
"ticketType": "child",
"ticketPrice": 9540,
"admits": 12,
"complimentaryAdmits": 2,
"revenueGross": 66550,
"revenueNet": 55800,
"tax": 8850
}
],
"approvedForBilling": false
}
]
}

---- Received ----
HTTP/1.1 404 Not Found
Server: nginx/1.14.2
Date: Fri, 09 Jun 2023 11:21:56 GMT
Content-Type: text/plain; charset=UTF-8
Content-Length: 83
Connection: keep-alive

The requested resource could not be found but may be available again in the future.

Joe

User avatar
Tom
Posts: 1170
Joined: Thu Jan 28, 2010 12:59 am
Location: Berlin, Germany

Re: Chilkat JSON Object

#15 Post by Tom »

Hi, Joe.

"404 - Not found" means your target (the endpoint you want to get data from) isn't available at the path you pointed to. There is something wrong with the URI you are trying to use.
Best regards,
Tom

"Did I offend you?"
"No."
"Okay, give me a second chance."

reganc
Posts: 257
Joined: Thu Jan 28, 2010 3:08 am
Location: Hersham, Surrey, UK
Contact:

Re: Chilkat JSON Object

#16 Post by reganc »

Hi Joe

The bit on the end of the URL that starts 'pepperoni' is not mentioned in the message you received from your web guy.
Or did I miss something...?
Regan Cawkwell
Real Business Applications Ltd
http://www.rbauk.com

Post Reply