Page 2 of 2

Re: Chilkat JSON Object

Posted: Thu Jun 08, 2023 2:58 am
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)

Re: Chilkat JSON Object

Posted: Thu Jun 08, 2023 4:51 am
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.

Re: Chilkat JSON Object

Posted: Fri Jun 09, 2023 3:06 am
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.

Re: Chilkat JSON Object

Posted: Fri Jun 09, 2023 4:32 am
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

Re: Chilkat JSON Object

Posted: Fri Jun 09, 2023 5:03 am
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.

Re: Chilkat JSON Object

Posted: Fri Jun 09, 2023 9:44 am
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...?