Watson Assistant maintaining conversation using Java SDK - ibm-cloud

I am trying to implement a chat assistant, using angular as client and calling Watson Assistant API from Java side.
For the first call am sending an empty input message and when I receive the context in the response am setting it to next message input to maintain the conversation context.
Here is the Java code
import javax.annotation.PostConstruct;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import com.xxxx.repapp.assistant.MessageInput;
import com.ibm.watson.developer_cloud.assistant.v1.Assistant;
import com.ibm.watson.developer_cloud.assistant.v1.model.InputData;
import com.ibm.watson.developer_cloud.assistant.v1.model.MessageOptions;
import com.ibm.watson.developer_cloud.assistant.v1.model.MessageResponse;
import com.ibm.watson.developer_cloud.service.exception.NotFoundException;
import com.ibm.watson.developer_cloud.service.exception.RequestTooLargeException;
import com.ibm.watson.developer_cloud.service.exception.ServiceResponseException;
#RestController
#RequestMapping("/app")
public class ConversationResource {
private static final String WORKSPACE_ID = "";
private static final String USERNAME = "";
private static final String PASSWORD = "";
Assistant service = new Assistant("2018-02-16");
#PostConstruct
public void init() {
service.setUsernameAndPassword(USERNAME, PASSWORD);
}
#RequestMapping(value = "rest/conversation/message", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
public MessageResponse consecutiveMessages(#RequestBody MessageInput messageInput) {
try {
InputData input = new InputData.Builder(messageInput.getText()).build();
MessageOptions options = new MessageOptions.Builder(WORKSPACE_ID).input(input)
.context(messageInput.getContext()).build();
MessageResponse response = service.message(options).execute();
return response;
} catch (NotFoundException e) {
// Handle Not Found (404) exception
} catch (RequestTooLargeException e) {
// Handle Request Too Large (413) exception
} catch (ServiceResponseException e) {
// Base class for all exceptions caused by error responses from the
// service
System.out.println("Service returned status code " + e.getStatusCode() + ": " + e.getMessage());
}
return null;
}
#RequestMapping(value = "rest/conversation/initialMessage", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public MessageResponse initialMessage() {
InputData input = new InputData.Builder("").build();
MessageOptions options = new MessageOptions.Builder(WORKSPACE_ID).input(input).build();
// sync way
MessageResponse response = service.message(options).execute();
return response;
// async way
/*
* service.message(options).enqueue(new
* ServiceCallback<MessageResponse>() {
*
* #Override public void onResponse(MessageResponse response) {
* System.out.println(response); }
*
* #Override public void onFailure(Exception e) { } });
*/
}
}
MessageInput class is
import com.ibm.watson.developer_cloud.assistant.v1.model.Context;
public class MessageInput extends com.ibm.watson.developer_cloud.assistant.v1.model.MessageInput{
private Context context;
public Context getContext() {
return context;
}
public void setContext(Context context) {
this.context = contextId;
}
}
When i have to continue the conversation, the conversation in getting restarted without maintaining context. Please look at the below flow of conversation.
welcome intent response
{
"output": {
"text": [
"Hello I am foo assistant. How can I help you?"
],
"nodes_visited": [
"Welcome"
],
"log_messages": []
},
"input": {
"text": ""
},
"intents": [],
"entities": [],
"context": {
"conversation_id": "b935786e-7e9d-499e-bb65-b6ddd23605a0",
"system": {
"dialog_stack": [
{
"dialog_node": "root"
}
],
"dialog_turn_counter": 1.0,
"dialog_request_counter": 1.0,
"_node_output_map": {
"Welcome": {
"0": [
0.0
]
}
},
"branch_exited": true,
"branch_exited_reason": "completed"
}
}
}
MessageOptions set in next request after setting input text and context
{
"workspaceId": "*************",
"input": {
"text": "submit meter read"
},
"context": {
"output": {
"text": [
"Hello I am foo assistant. How can I help you?"
],
"nodes_visited": [
"Welcome"
],
"log_messages": []
},
"input": {
"text": ""
},
"intents": [],
"entities": [],
"context": {
"conversation_id": "b935786e-7e9d-499e-bb65-b6ddd23605a0",
"system": {
"dialog_stack": [
{
"dialog_node": "root"
}
],
"dialog_turn_counter": 1,
"dialog_request_counter": 1,
"_node_output_map": {
"Welcome": {
"0": [
0
]
}
},
"branch_exited": true,
"branch_exited_reason": "completed"
}
}
}
}
null
{
"output": {
"text": [
"Hello I am foo assistant. How can I help you?"
],
"nodes_visited": [
"Welcome"
],
"log_messages": []
},
"input": {
"text": ""
},
"intents": [],
"entities": [],
"context": {
"conversation_id": "b935786e-7e9d-499e-bb65-b6ddd23605a0",
"system": {
"dialog_stack": [
{
"dialog_node": "root"
}
],
"dialog_turn_counter": 1,
"dialog_request_counter": 1,
"_node_output_map": {
"Welcome": {
"0": [
0
]
}
},
"branch_exited": true,
"branch_exited_reason": "completed"
}
}
}
null
{
"text": "submit meter read"
}
Message Options next time after inputting meter read date
{
"workspaceId": "*************",
"input": {
"text": "2018-09-09"
},
"context": {
"output": {
"text": [
"Please enter meter read date"
],
"nodes_visited": [
"node_1_1534239058536",
"handler_4_1534239240239",
"slot_2_1534239240239"
],
"log_messages": []
},
"input": {
"text": "submit meter read"
},
"intents": [
{
"intent": "submit_meter_read",
"confidence": 0.9712400913238526
}
],
"entities": [],
"context": {
"output": {
"text": [
"Hello I am foo assistant. How can I help you?"
],
"nodes_visited": [
"Welcome"
],
"log_messages": []
},
"input": {
"text": ""
},
"intents": [],
"entities": [],
"context": {
"conversation_id": "b935786e-7e9d-499e-bb65-b6ddd23605a0",
"system": {
"dialog_stack": [
{
"dialog_node": "root"
}
],
"dialog_turn_counter": 1,
"dialog_request_counter": 1,
"_node_output_map": {
"Welcome": {
"0": [
0
]
}
},
"branch_exited": true,
"branch_exited_reason": "completed"
}
},
"conversation_id": "ccfba8ad-06e2-4a74-95e3-20f8251c264c",
"system": {
"dialog_stack": [
{
"dialog_node": "slot_2_1534239240239",
"state": "in_progress"
}
],
"dialog_turn_counter": 1,
"dialog_request_counter": 1,
"_node_output_map": {}
}
}
}
}
Now the response expected should continue to ask one more slot to fill, but its getting resetted, if you observe below response.
{
"output": {
"text": [
"I didn't understand. You can try rephrasing. I can help you with things like meter read submission, raising a complaint, and giving some general information."
],
"nodes_visited": [
"Anything else"
],
"log_messages": []
},
"input": {
"text": "2018-09-09"
},
"intents": [],
"entities": [
{
"entity": "sys-number",
"location": [
0.0,
4.0
],
"value": "2018",
"confidence": 1.0,
"metadata": {
"numeric_value": 2018.0
}
},
{
"entity": "sys-date",
"location": [
0.0,
10.0
],
"value": "2018-09-09",
"confidence": 1.0,
"metadata": {
"calendar_type": "GREGORIAN",
"timezone": "GMT"
}
},
{
"entity": "sys-number",
"location": [
4.0,
7.0
],
"value": "-9",
"confidence": 1.0,
"metadata": {
"numeric_value": -9.0
}
},
{
"entity": "sys-number",
"location": [
7.0,
10.0
],
"value": "-9",
"confidence": 1.0,
"metadata": {
"numeric_value": -9.0
}
}
],
"context": {
"output": {
"text": [
"Please enter meter read date"
],
"nodes_visited": [
"node_1_1534239058536",
"handler_4_1534239240239",
"slot_2_1534239240239"
],
"log_messages": []
},
"input": {
"text": "submit meter read"
},
"intents": [
{
"intent": "submit_meter_read",
"confidence": 0.9712400913238526
}
],
"entities": [],
"context": {
"output": {
"text": [
"Hello I am foo assistant. How can I help you?"
],
"nodes_visited": [
"Welcome"
],
"log_messages": []
},
"input": {
"text": ""
},
"intents": [],
"entities": [],
"context": {
"conversation_id": "b935786e-7e9d-499e-bb65-b6ddd23605a0",
"system": {
"dialog_stack": [
{
"dialog_node": "root"
}
],
"dialog_turn_counter": 1.0,
"dialog_request_counter": 1.0,
"_node_output_map": {
"Welcome": {
"0": [
0.0
]
}
},
"branch_exited": true,
"branch_exited_reason": "completed"
}
},
"conversation_id": "ccfba8ad-06e2-4a74-95e3-20f8251c264c",
"system": {
"dialog_stack": [
{
"dialog_node": "slot_2_1534239240239",
"state": "in_progress"
}
],
"dialog_turn_counter": 1.0,
"dialog_request_counter": 1.0,
"_node_output_map": {}
}
},
"conversation_id": "39f82cb9-e0f1-47b9-845e-892c0d589aed",
"system": {
"dialog_stack": [
{
"dialog_node": "root"
}
],
"dialog_turn_counter": 1.0,
"dialog_request_counter": 1.0,
"_node_output_map": {
"Anything else": {
"0": [
0.0,
0.0,
2.0,
1.0
]
}
},
"branch_exited": true,
"branch_exited_reason": "completed"
}
}
}
Where am missing in the above code, please help me out maintaining conversation flow. Thanks

You need to send the context obtained from the response. You seem to retrieve the context off the input object. Where is the context information transfered from the response to your MessageInput object?
You probably have seen this example for two consecutive messages: https://github.com/watson-developer-cloud/java-sdk/tree/master/assistant

Related

JOLT - filtering array based on object value

how can I do this?
This is the array....
Can you please help me?
Can you please give me the answer???? Thanks a lot
{
"results": {
"data": [
{
"name": "xx",
"typeRelationship": [
{
"relationship": "parent",
"type": {
"id": "yyyyy",
}
}
],
"id": "xxxxxxxx"
},
{
"name": "yy",
"typeRelationship": [
{
"relationshipType": "parent",
"type": {
"id": "CCCC"
}
},
{
"relationshipType": "child",
"service": {
"id": "DDDD"
}
},
{
"relationshipType": "child",
"service": {
"id": "xxxxxxxx"
}
}
],
"id": "yyyyy"
}
]
}}
expected:
This is expected:
{
"data" : [ {
"id" : "xxxx",
"href" : "xxxxxx",
"relation":"parent"
} ]
}
For some reason I need to type so it does let me update!!!
This works.
[
{
"operation": "shift",
"spec": {
"data": {
"*": {
"type": {
"id": {
"xxxx": {
"#3": "data[]"
}
}
}
}
}
}
}
]
Edit 1
The below spec moves all the values which as id=xxxxx to the data array.
[
{
"operation": "shift",
"spec": {
"data": {
"*": {
"type": {
"*": {
"id": {
"xxxx": {
"#(2)": "data[]",
"#(4,relation)": "data[&3].relation"
}
}
}
}
}
}
}
}
]
This totally works.
Thanks.
Can you please let me know what is 2? 3? 4?
Because my array is a bit different and I want to fix those numbers but does not work....
{
"results": {
"data": [
{
"name": "xx",
"typeRelationship": [
{
"relationship": "parent",
"type": {
"id": "yyyyy",
}
}
],
"id": "xxxxxxxx"
},
{
"name": "yy",
"typeRelationship": [
{
"relationshipType": "parent",
"type": {
"id": "CCCC"
}
},
{
"relationshipType": "child",
"service": {
"id": "DDDD"
}
},
{
"relationshipType": "child",
"service": {
"id": "xxxxxxxx"
}
}
],
"id": "yyyyy"
}
]
}
}
expected:
{
"rows" : [ {
"rowdata" : {
"relationshipType" : "child",
"Name" : "yy",
"id" : "yyyyy"
}
} ]
}

Application insights sink option not showing Performance counter in the Application insights for service fabric

Below is the configuration I have setup for Application Insights sink to send EtwEventSourceProviderConfiguration and EtwManifestProviderConfiguration and PerformanceCounters.
"WadCfg": {
"DiagnosticMonitorConfiguration": {
"overallQuotaInMB": "50000",
"sinks": "applicationInsights",
"EtwProviders": {
"EtwEventSourceProviderConfiguration": [
{
"provider": "Microsoft-ServiceFabric-Actors",
"scheduledTransferKeywordFilter": "1",
"scheduledTransferPeriod": "PT5M",
"DefaultEvents": {
"eventDestination": "ServiceFabricReliableActorEventTable"
}
},
{
"provider": "Microsoft-ServiceFabric-Services",
"scheduledTransferPeriod": "PT5M",
"DefaultEvents": {
"eventDestination": "ServiceFabricReliableServiceEventTable"
}
}
],
"EtwManifestProviderConfiguration": [
{
"provider": "cbd93bc2-xxxx-4566-b3a7-xxxxxxxx",
"scheduledTransferLogLevelFilter": "Information",
"scheduledTransferKeywordFilter": "4611686018427387904",
"scheduledTransferPeriod": "PT5M",
"DefaultEvents": {
"eventDestination": "ServiceFabricSystemEventTable"
}
}
]
},
"PerformanceCounters": {
"scheduledTransferPeriod": "PT1M",
"PerformanceCounterConfiguration": [
{
"counterSpecifier": "\\Processor(_Total)\\% Processor Time",
"sampleRate": "PT1M",
"unit": "Percent",
"sinks": "applicationInsights"
},
{
"counterSpecifier": "\\Process(My.WebAPI)\\Private Bytes",
"sampleRate": "PT1M",
"sinks": "applicationInsights"
}
]
}
},
"SinksConfig": {
"Sink": [
{
"name": "applicationInsights",
"ApplicationInsights": "d504ba9a-xxx-42b7-xxxx-xxxxxxxxxx"
},
{
"name": "MyApplicationInsightsProfilerSink",
"ApplicationInsightsProfiler": "d504ba9a-xxxx-42b7-xxxx-xxxxxxxxx"
}
]
}
},
"StorageAccount": "sfdgjsxxxxxxxxxxxx"
}
}
},
I do not see any of the events or performance counter in Log.

Google Assistant : account linking and Actions sdk : fail to see sign in message

I want to enable account linking on an Google Assistant application using Actions Sdk.
I have already provided the information in the Account Linking section of the AoG Console :
The grant Type is Authorization code.
I use Auth0 as Oauth Server and i checked that the endpoints are functional.
When the application is invoked using the simulator, the server application send the following json response :
{
"expectUserResponse": true,
"finalResponse": null,
"expectedInputs": [{
"possibleIntents": [{
"intent": "actions.intent.SIGN_IN",
"inputValueData": null
}],
"inputPrompt": {
"richInitialPrompt": {
"items": [{
"simpleResponse": {
"textToSpeech": "Merci de vous authentifier",
"ssml": null,
"displayText": "Merci de vous authentifier"
}
}]
}
}
}],
"conversationToken": null,
"isInSandbox": false
}
I expected then to see the message like : it looks like your account … is not linked
Instead of that, the assistant immediately sends the following request to the server :
{
"user": {
"userId": "ABwppHGK6fClByrbLlS8WDM4xfY0qEck5i_kOGMhlJtuj64SjC-8qDqlH3xZ3BN7f9Yz1JDza-sc",
"locale": "fr-CA",
"lastSeen": "2018-04-23T14:12:02Z"
},
"conversation": {"conversationId": "1524493058716", "type": "NEW"},
"inputs": [{
"intent": "actions.intent.SIGN_IN",
"rawInputs": [{"inputType": "KEYBOARD"}],
"arguments": [{
"name": "SIGN_IN",
"extension": {
"#type": "type.googleapis.com/google.actions.v2.SignInValue",
"status": "ERROR"
}
}]
}],
"surface": {
"capabilities": [
{"name": "actions.capability.WEB_BROWSER"},
{"name": "actions.capability.MEDIA_RESPONSE_AUDIO"},
{"name": "actions.capability.SCREEN_OUTPUT"},
{"name": "actions.capability.AUDIO_OUTPUT"}
]
},
"isInSandbox": true,
"availableSurfaces": [
{
"capabilities": [
{"name": "actions.capability.SCREEN_OUTPUT"},
{"name": "actions.capability.AUDIO_OUTPUT"}
]
}
]
}
Did someone have the same problem ? Thanks
I have a working example, but it might be different of what you are doing because I ask the sign-in with dialogflow Integrations' tab for Google Assistant, and not explicitely with the SDK. The code is for the V2 of Dialogflow, I also have one for the V1 but it is now legacy.
This is my BONJOUR intent that is triggered when my app is launched:
const rp = require('request-promise');
app.intent('BONJOUR', (conv) => {
console.log("Debug: SAY_HELLO");
const accessToken = conv.user.access.token;
console.log("Access Token = "+accessToken);
//========Auth with OAuth website========
if (!accessToken) {
conv.ask(new SignIn());
} else {
let options = {
method: 'GET',
url: '[...]',//Oauth URL
headers:{
authorization: 'Bearer ' + accessToken,
}
};
// I use the RP lib as we need Promises for the V2 of Dialogflow.
return rp(options).then((body) => {
let data = JSON.parse(body);
console.log("auth data ="+JSON.stringify(data));
//You can access the auth data easily here
// For example if you want the name, it's in data.given_name, etc...
//Use conv.ask() to say something here
}).catch((error) => {
console.log("Error in auth request"+error);
})
}
});
Update:
This is my JSON mais the SignIn() is called, as I just tested it, it doesn't work (I created an intent that receives the actions_intent_SIGN_IN event from an example. And it never asks for sign In , I'm always in the else.)
Response {
"payload": {
"google": {
"expectUserResponse": true,
"richResponse": {
"items": [
{
"simpleResponse": {
"textToSpeech": "PLACEHOLDER"
}
}
]
},
"userStorage": "{\"data\":{}}",
"systemIntent": {
"intent": "actions.intent.SIGN_IN",
"data": {
"#type": "type.googleapis.com/google.actions.v2.SignInValueSpec"
}
}
}
},
"outputContexts": [
{
"name": [...],
"lifespanCount": 99,
"parameters": {
"data": "{}"
}
}
]
}
Then the request after that is:
Request {
"responseId": "5a711f0e-be66-4311-b776-2085e81e9bde",
"queryResult": {
"queryText": "actions_intent_SIGN_IN",
"parameters": {},
"allRequiredParamsPresent": true,
"fulfillmentMessages": [
{
"text": {
"text": [
""
]
}
}
],
"outputContexts": [
{
"name": "..."
},
{
"name": ".../actions_intent_sign_in",
"parameters": {
"SIGN_IN": {
"#type": "type.googleapis.com/google.actions.v2.SignInValue",
"status": "ERROR"
}
}
},
{
"name": "...",
"lifespanCount": 98,
"parameters": {
"data": "{}"
}
},
{
"name": "..."
},
{
"name": "..."
},
{
"name": "..."
},
{
"name": "..."
}
],
"intent": {
"name": "...",
"displayName": "Get Signin"
},
"intentDetectionConfidence": 1,
"diagnosticInfo": {},
"languageCode": "fr-fr"
},
"originalDetectIntentRequest": {
"source": "google",
"version": "2",
"payload": {
"isInSandbox": true,
"surface": {
"capabilities": [
{
"name": "actions.capability.WEB_BROWSER"
},
{
"name": "actions.capability.MEDIA_RESPONSE_AUDIO"
},
{
"name": "actions.capability.SCREEN_OUTPUT"
},
{
"name": "actions.capability.AUDIO_OUTPUT"
}
]
},
"inputs": [
{
"rawInputs": [
{
"inputType": "KEYBOARD"
}
],
"arguments": [
{
"extension": {
"#type": "type.googleapis.com/google.actions.v2.SignInValue",
"status": "ERROR"
},
"name": "SIGN_IN"
}
],
"intent": "actions.intent.SIGN_IN"
}
],
"user": {
"userStorage": "{\"data\":{}}",
"lastSeen": "2018-04-24T12:21:19Z",
"locale": "fr-FR",
"userId": "ABwppHHXrOc7N24RC5YS1dMvt7C-MbpzTb5TtzmufeIpGTCINVlReIMb8RKo4SGQMgBY7BUvO1qhn0B-"
},
"conversation": {
"conversationId": "1524572717282",
"type": "ACTIVE",
"conversationToken": "[\"_actions_on_google\"]"
},
"availableSurfaces": [
{
"capabilities": [
{
"name": "actions.capability.SCREEN_OUTPUT"
},
{
"name": "actions.capability.AUDIO_OUTPUT"
}
]
}
]
}
},
"session": "..."
}
I hope it can help you somehow.

"Client invalid path, not found in rest table" does anyone know what this Sabre's error means

I want to use this API service:
https://developer.sabre.com/docs/read/rest_apis/air/book/create_passenger_name_record
and the server responds with this json:
{
"status": "NotProcessed",
"type": "Application",
"errorCode": "ERR.2SG.CLIENT.INVALID_REQUEST",
"timeStamp": "2017-09-12T13:21:29.522-05:00",
"message": "Client invalid path, not found in rest table"
}
As mentioned in the comments, the endpoint is not right. After fixing that you'd get many different errors, for example you are referencing a Profile ID ABCDEF that doesn't exist.
I've modified that request so you'd get a successful response.
v2.0.0/passenger/records?mode=create
{
"CreatePassengerNameRecordRQ": {
"targetCity": "XXXX",
"TravelItineraryAddInfo": {
"AgencyInfo": {
"Ticketing": {
"TicketType": "7TAW/"
}
},
"CustomerInfo": {
"ContactNumbers": {
"ContactNumber": [
{
"Phone": "817-555-1212",
"PhoneUseType": "H"
}
]
},
"PersonName": [
{
"GivenName": "TEST",
"Surname": "TEST"
}
]
}
},
"AirBook": {
"OriginDestinationInformation": {
"FlightSegment": [
{
"ArrivalDateTime": "2018-07-20T14:20",
"DepartureDateTime": "2018-07-20T12:57",
"FlightNumber": "2404",
"NumberInParty": "1",
"ResBookDesigCode": "Y",
"Status": "NN",
"DestinationLocation": {
"LocationCode": "LAX"
},
"MarketingAirline": {
"Code": "AA",
"FlightNumber": "2404"
},
"MarriageGrp": "O",
"OriginLocation": {
"LocationCode": "DFW"
}
}
]
}
},
"AirPrice": {
"PriceRequestInformation": {
"OptionalQualifiers": {
"PricingQualifiers": {
"PassengerType": [
{
"Code": "ADT",
"Quantity": "1"
}
]
}
}
}
},
"MiscSegment": {
"DepartureDateTime": "2018-10-29",
"NumberInParty": 1,
"Status": "NN",
"Type": "OTH",
"OriginLocation": {
"LocationCode": "LAS"
},
"Text": "TEST",
"VendorPrefs": {
"Airline": {
"Code": "AA"
}
}
},
"SpecialReqDetails": {
"AddRemark": {
"RemarkInfo": {
"FOP_Remark": {
"Type": "CHECK",
"CC_Info": {
"Suppress": true,
"PaymentCard": {
"AirlineCode": "YY",
"CardSecurityCode": "1234",
"Code": "VI",
"ExpireDate": "2012-12",
"ExtendedPayment": "12",
"ManualApprovalCode": "123456",
"Number": "4123412341234123",
"SuppressApprovalCode": true
}
}
},
"Remark": [
{
"Type": "Historical",
"Text": "TEST HISTORICAL REMARK"
},
{
"Type": "Invoice",
"Text": "TEST INVOICE REMARK"
},
{
"Type": "Itinerary",
"Text": "TEST ITINERARY REMARK"
},
{
"Type": "Hidden",
"Text": "TEST HIDDEN REMARK"
}
]
}
},
"AirSeat": {
"Seats": {
"Seat": [
{
"NameNumber": "1.1",
"Preference": "AN",
"SegmentNumber": "1"
}
]
}
},
"SpecialService": {
"SpecialServiceInfo": {
"Service": [
{
"SSR_Code": "OSI",
"PersonName": {
"NameNumber": "1.1"
},
"Text": "TEST",
"VendorPrefs": {
"Airline": {
"Code": "UA"
}
}
}
]
}
}
},
"PostProcessing": {
"RedisplayReservation": true,
"EndTransaction": {
"Source": {
"ReceivedFrom": "SWS TEST"
}
}
}
}
}

REST API 'Create Passenger Name Record' Warning and errors

The below attached warnings and error occurred while testing Booking seat.
There is no any proper documentation of Create Passenger Name Record REST API Call, the description and schema are meaning less. In description there are 266 parameters are required true to send a request.
Do you have any proper documentation where i can get all the required parameters detailed information? Like What is SegmentNumber how can i get?
Working flow( For Single trip) :
Get the origin, destination, date, number of seats required.
Send all required parms to Bargain Finder Max, get the response
Send Require params to book a seat. Create Passenger Name Record
Request
{
"CreatePassengerNameRecordRQ": {
"targetCity": "3QND",
"Profile": {
"UniqueID": {
"ID": "ABCD1EF"
}
},
"AirBook": {
"OriginDestinationInformation": {
"FlightSegment": [{
"ArrivalDateTime": "2017-04-30",
"DepartureDateTime": "2017-04-30T13:55",
"FlightNumber": "309",
"NumberInParty": "1",
"ResBookDesigCode": "V",
"Status": "NN",
"DestinationLocation": {
"LocationCode": "KHI"
},
"MarketingAirline": {
"Code": "PK",
"FlightNumber": "309"
},
"MarriageGrp": "O",
"OriginLocation": {
"LocationCode": "ISB"
}
}]
}
},
"AirPrice": {
"PriceRequestInformation": {
"OptionalQualifiers": {
"MiscQualifiers": {
"TourCode": {
"Text": "TEST1212"
}
},
"PricingQualifiers": {
"PassengerType": [{
"Code": "CNN",
"Quantity": "1"
}]
}
}
}
},
"MiscSegment": {
"DepartureDateTime": "2017-04-30",
"NumberInParty": 1,
"Status": "NN",
"Type": "OTH",
"OriginLocation": {
"LocationCode": "ISB"
},
"Text": "TEST",
"VendorPrefs": {
"Airline": {
"Code": "PK"
}
}
},
"SpecialReqDetails": {
"AddRemark": {
"RemarkInfo": {
"FOP_Remark": {
"Type": "CHECK",
"CC_Info": {
"Suppress": true,
"PaymentCard": {
"AirlineCode": "PK",
"CardSecurityCode": "1234",
"Code": "VI",
"ExpireDate": "2012-12",
"ExtendedPayment": "12",
"ManualApprovalCode": "123456",
"Number": "4123412341234123",
"SuppressApprovalCode": true
}
}
},
"FutureQueuePlaceRemark": {
"Date": "12-21",
"PrefatoryInstructionCode": "11",
"PseudoCityCode": "IPCC1",
"QueueIdentifier": "499",
"Time": "06:00"
},
"Remark": [{
"Type": "Historical",
"Text": "TEST HISTORICAL REMARK"
},
{
"Type": "Invoice",
"Text": "TEST INVOICE REMARK"
},
{
"Type": "Itinerary",
"Text": "TEST ITINERARY REMARK"
},
{
"Type": "Hidden",
"Text": "TEST HIDDEN REMARK"
}]
}
},
"AirSeat": {
"Seats": {
"Seat": [{
"NameNumber": "1.1",
"Preference": "AN",
"SegmentNumber": "0"
},
{
"NameNumber": "2.1",
"Preference": "AN",
"SegmentNumber": "1"
},
{
"NameNumber": "3.1",
"Preference": "AN",
"SegmentNumber": "1"
}]
}
},
"SpecialService": {
"SpecialServiceInfo": {
"Service": [{
"SSR_Code": "OSI",
"PersonName": {
"NameNumber": "testing"
#},
"Text": "TEST1",
"VendorPrefs": {
"Airline": {
"Code": "PK"
}
}
}]
}
}
},
"PostProcessing": {
"RedisplayReservation": true,
"ARUNK": "",
"QueuePlace": {
"QueueInfo": {
"QueueIdentifier": [{
"Number": "100",
"PrefatoryInstructionCode": "11"
}]
}
},
"EndTransaction": {
"Source": {
"ReceivedFrom": "SWS TEST"
}
}
}
}
}
Response:
{
"CreatePassengerNameRecordRS": {
"ApplicationResults": {
"status": "NotProcessed",
"Error": [
{
"type": "Application",
"timeStamp": "2017-03-08T04:10:41.317-06:00",
"SystemSpecificResults": [
{
"Message": [
{
"code": "ERR.SP.BUSINESS_ERROR",
"content": "PNR has not been created successfully, see remaining messages for details"
}
]
}
]
}
],
"Warning": [
{
"type": "BusinessLogic",
"timeStamp": "2017-03-08T04:10:40.628-06:00",
"SystemSpecificResults": [
{
"Message": [
{
"code": "WARN.SP.PROVIDER_ERROR",
"content": "NO PROFILE FOUND FOR NAME"
}
]
}
]
},
{
"type": "Validation",
"timeStamp": "2017-03-08T04:10:40.655-06:00",
"SystemSpecificResults": [
{
"Message": [
{
"code": "WARN.SWS.CLIENT.VALIDATION_FAILED",
"content": "Request contains incorrect values: Wrong dateTime format"
}
]
}
]
},
{
"type": "BusinessLogic",
"timeStamp": "2017-03-08T04:10:40.919-06:00",
"SystemSpecificResults": [
{
"Message": [
{
"code": "WARN.SWS.HOST.ERROR_IN_RESPONSE",
"content": "FORMAT, CHECK SEGMENT NUMBER-0003"
}
]
}
]
},
{
"type": "BusinessLogic",
"timeStamp": "2017-03-08T04:10:41.024-06:00",
"SystemSpecificResults": [
{
"Message": [
{
"code": "WARN.SWS.HOST.ERROR_IN_RESPONSE",
"content": ".DTE.NOT ENT BGNG WITH"
}
]
}
]
},
{
"type": "BusinessLogic",
"timeStamp": "2017-03-08T04:10:41.062-06:00",
"SystemSpecificResults": [
{
"Message": [
{
"code": "WARN.SWS.HOST.ERROR_IN_RESPONSE",
"content": "\u0087ND NAMES\u0087"
}
]
}
]
},
{
"type": "BusinessLogic",
"timeStamp": "2017-03-08T04:10:41.096-06:00",
"SystemSpecificResults": [
{
"Message": [
{
"code": "WARN.SWS.HOST.ERROR_IN_RESPONSE",
"content": "\u0087ND NAMES\u0087"
}
]
}
]
},
{
"type": "BusinessLogic",
"timeStamp": "2017-03-08T04:10:41.129-06:00",
"SystemSpecificResults": [
{
"Message": [
{
"code": "WARN.SWS.HOST.ERROR_IN_RESPONSE",
"content": "\u0087ND NAMES\u0087"
}
]
}
]
},
{
"type": "BusinessLogic",
"timeStamp": "2017-03-08T04:10:41.166-06:00",
"SystemSpecificResults": [
{
"Message": [
{
"code": "WARN.SWS.HOST.ERROR_IN_RESPONSE",
"content": "NO ARNK INSERTED"
}
]
}
]
},
{
"type": "BusinessLogic",
"timeStamp": "2017-03-08T04:10:41.229-06:00",
"SystemSpecificResults": [
{
"Message": [
{
"code": "WARN.SWS.HOST.ERROR_IN_RESPONSE",
"content": "NEED PHONE FIELD - USE 9"
}
]
}
]
}
]
},
"TravelItineraryRead": {
"TravelItinerary": {
"CustomerInfo": {
},
"ItineraryInfo": {
"ReservationItems": {
"Item": [
{
"RPH": "1",
"MiscSegment": {
"DayOfWeekInd": "7",
"DepartureDateTime": "04-30",
"NumberInParty": "01",
"SegmentNumber": "0001",
"Status": "NN",
"Type": "OTH",
"IsPast": false,
"OriginLocation": {
"LocationCode": "ISB"
},
"Text": [
"TEST"
],
"Vendor": {
"Code": "PK"
}
}
}
]
}
},
"ItineraryRef": {
"AirExtras": false,
"InhibitCode": "U",
"PartitionID": "AA",
"PrimeHostID": "1B",
"Header": [
"CURRENTLY DISPLAYING A PNR OWNED BY THE SABRE PRIME HOST",
"RULES AND FUNCTIONALITY FOR THAT PRIME HOST WILL APPLY"
],
"Source": {
"PseudoCityCode": "3QND",
"ReceivedFrom": "SWS TEST"
}
},
"SpecialServiceInfo": [
{
"RPH": "001",
"Type": "GFX",
"Service": {
"SSR_Code": "OSI",
"Airline": {
"Code": "PK"
},
"Text": [
"TEST1-TESTING"
]
}
}
]
}
}
},
"Links": [
{
"rel": "self",
"href": "https:\/\/api.sabre.com\/v1.0.0\/passenger\/records?mode=create"
},
{
"rel": "linkTemplate",
"href": "https:\/\/api.sabre.com\/\/passenger\/records?mode="
}
]
}
Please avoid posting the same questions. Here's an answer I just posted regarding the required elements: https://stackoverflow.com/a/42671412/3701641
About the segment number, they represent the itinerary segments, you are adding one flight segment, so the segment number associated with that would be 1.