Extract value from response and use it in next sampler request body specific - jmeter-5.0

How to extract an id like 5105800, 5105801, 5105802 and his quantity 200, 50 , 40 from response Body and reuse it in the request body as show below?
Response Body:
{
"data": {
"callOrders": [
{
"promotionId": null,
"Promotion": null,
"Lines": [
{
"id": 5105800,
"quantity": 200,
"skuId": 85,
"callId": 494281,
"skuBatchId": 587,
"amountDetails": {
"rate": 144.22,
"grossAmount": 32593.72,
"netAmount": 32593.72,
"taxAmount": 3749.72,
"taxableAmount": 28844,
"subTotal": 28844,
"billDiscount": 0,
"tradeDiscount": 0,
"discountAmount": 0,
"promotionDiscount": 0,
"topUpDiscount": 0,
"__typename": "AmountDetail"
},
"rateDetails": {
"rlp": 144.22,
"rlpWithVat": 162.9686,
"netPrice": 144.22,
"netPriceWithVat": 162.9686,
"__typename": "RateDetail"
},
"SKU": {
"id": 85,
"title": "Ariel Oxyblu 500 gm x 48 [82262305]",
"__typename": "SKU"
},
"SKUBatch": {
"priceDetails": {
"rlp": 144.22,
"dlp": 137.35,
"vatPercentage": 0.13,
"mrpSrp": 176,
"mrpStatus": true,
"__typename": "SKUPrice"
},
"batchDetails": {
"batchNumber": "DEFAULT_BATCH",
"__typename": "SKUBatch"
},
"usageDate": {
"manufacture": "0000-00-00",
"expiry": "0000-00-00",
"__typename": "SKUUsage"
},
"updatedAt": "2018-12-01",
"active": true,
"__typename": "SKUBatchRate"
},
"Promotion": {
"id": null,
"title": null,
"type": null,
"scope": null,
"criteria": null,
"__typename": "Promotion"
},
"promotionId": null,
"distributorId": 16,
"__typename": "Line",
"inStock": "INSTOCK",
"freeSku": false,
"focusedSku": true
},
{
"id": 5105801,
"quantity": 50,
"skuId": 82,
"callId": 494281,
"skuBatchId": 551,
"amountDetails": {
"rate": 281.88,
"grossAmount": 15926.22,
"netAmount": 15926.22,
"taxAmount": 1832.22,
"taxableAmount": 14094,
"subTotal": 14094,
"billDiscount": 0,
"tradeDiscount": 0,
"discountAmount": 0,
"promotionDiscount": 0,
"topUpDiscount": 0,
"__typename": "AmountDetail"
},
"rateDetails": {
"rlp": 281.88,
"rlpWithVat": 318.5244,
"netPrice": 281.88,
"netPriceWithVat": 318.5244,
"__typename": "RateDetail"
},
"SKU": {
"id": 82,
"title": "Ariel Oxyblu 1 kg x 24 [82250306]",
"__typename": "SKU"
},
"SKUBatch": {
"priceDetails": {
"rlp": 281.88,
"dlp": 268.45,
"vatPercentage": 0.13,
"mrpSrp": 344,
"mrpStatus": true,
"__typename": "SKUPrice"
},
"batchDetails": {
"batchNumber": "DEFAULT_BATCH",
"__typename": "SKUBatch"
},
"usageDate": {
"manufacture": "0000-00-00",
"expiry": "0000-00-00",
"__typename": "SKUUsage"
},
"updatedAt": "2018-01-31",
"active": true,
"__typename": "SKUBatchRate"
},
"Promotion": {
"id": null,
"title": null,
"type": null,
"scope": null,
"criteria": null,
"__typename": "Promotion"
},
"promotionId": null,
"distributorId": 16,
"__typename": "Line",
"inStock": "INSTOCK",
"freeSku": false,
"focusedSku": true
},
{
"id": 5105802,
"quantity": 40,
"skuId": 769,
"callId": 494281,
"skuBatchId": 733,
"amountDetails": {
"rate": 197.53,
"grossAmount": 8928.356,
"netAmount": 8928.356,
"taxAmount": 1027.156,
"taxableAmount": 7901.2,
"subTotal": 7901.2,
"billDiscount": 0,
"tradeDiscount": 0,
"discountAmount": 0,
"promotionDiscount": 0,
"topUpDiscount": 0,
"__typename": "AmountDetail"
},
"rateDetails": {
"rlp": 197.53,
"rlpWithVat": 223.2089,
"netPrice": 197.53,
"netPriceWithVat": 223.2089,
"__typename": "RateDetail"
},
"SKU": {
"id": 769,
"title": "H&S 2in1 Active Protect 180 ml x 24 [82302894]",
"__typename": "SKU"
},
"SKUBatch": {
"priceDetails": {
"rlp": 197.53,
"dlp": 186.35,
"vatPercentage": 0.13,
"mrpSrp": 250,
"mrpStatus": true,
"__typename": "SKUPrice"
},
"batchDetails": {
"batchNumber": "DEFAULT_BATCH",
"__typename": "SKUBatch"
},
"usageDate": {
"manufacture": "0000-00-00",
"expiry": "0000-00-00",
"__typename": "SKUUsage"
},
"updatedAt": "2019-11-05",
"active": true,
"__typename": "SKUBatchRate"
},
"Promotion": {
"id": null,
"title": null,
"type": null,
"scope": null,
"criteria": null,
"__typename": "Promotion"
},
"promotionId": null,
"distributorId": 16,
"__typename": "Line",
"inStock": "INSTOCK",
"freeSku": false,
"focusedSku": false
}
],
"__typename": "PromotionOrder"
}
]
}
}
Request Body:
{
"operationName": null,
"variables": {
"input": {
"invoiceId": 3683663,
"orderDetails": [
{
"id": 5105800,
"quantity": 200
},
{
"id": 5105801,
"quantity": 50
},
{
"id": 5105802,
"quantity": 40
}
]
},
"type": "CatalogDetail"
},
"query": "mutation ($input: DispatchInput!) {\n dispatchInvoice(input: $input) {\n id\n __typename\n }\n}\n"
}

When you use JavaScript, you could use the following one :)
const responseBody = {
"data": {
"callOrders": [
{
"promotionId": null,
"Promotion": null,
"Lines": [
{
"id": 5105800,
"quantity": 200,
"skuId": 85,
"callId": 494281,
"skuBatchId": 587,
"amountDetails": {
"rate": 144.22,
"grossAmount": 32593.72,
"netAmount": 32593.72,
"taxAmount": 3749.72,
"taxableAmount": 28844,
"subTotal": 28844,
"billDiscount": 0,
"tradeDiscount": 0,
"discountAmount": 0,
"promotionDiscount": 0,
"topUpDiscount": 0,
"__typename": "AmountDetail"
},
"rateDetails": {
"rlp": 144.22,
"rlpWithVat": 162.9686,
"netPrice": 144.22,
"netPriceWithVat": 162.9686,
"__typename": "RateDetail"
},
"SKU": {
"id": 85,
"title": "Ariel Oxyblu 500 gm x 48 [82262305]",
"__typename": "SKU"
},
"SKUBatch": {
"priceDetails": {
"rlp": 144.22,
"dlp": 137.35,
"vatPercentage": 0.13,
"mrpSrp": 176,
"mrpStatus": true,
"__typename": "SKUPrice"
},
"batchDetails": {
"batchNumber": "DEFAULT_BATCH",
"__typename": "SKUBatch"
},
"usageDate": {
"manufacture": "0000-00-00",
"expiry": "0000-00-00",
"__typename": "SKUUsage"
},
"updatedAt": "2018-12-01",
"active": true,
"__typename": "SKUBatchRate"
},
"Promotion": {
"id": null,
"title": null,
"type": null,
"scope": null,
"criteria": null,
"__typename": "Promotion"
},
"promotionId": null,
"distributorId": 16,
"__typename": "Line",
"inStock": "INSTOCK",
"freeSku": false,
"focusedSku": true
},
{
"id": 5105801,
"quantity": 50,
"skuId": 82,
"callId": 494281,
"skuBatchId": 551,
"amountDetails": {
"rate": 281.88,
"grossAmount": 15926.22,
"netAmount": 15926.22,
"taxAmount": 1832.22,
"taxableAmount": 14094,
"subTotal": 14094,
"billDiscount": 0,
"tradeDiscount": 0,
"discountAmount": 0,
"promotionDiscount": 0,
"topUpDiscount": 0,
"__typename": "AmountDetail"
},
"rateDetails": {
"rlp": 281.88,
"rlpWithVat": 318.5244,
"netPrice": 281.88,
"netPriceWithVat": 318.5244,
"__typename": "RateDetail"
},
"SKU": {
"id": 82,
"title": "Ariel Oxyblu 1 kg x 24 [82250306]",
"__typename": "SKU"
},
"SKUBatch": {
"priceDetails": {
"rlp": 281.88,
"dlp": 268.45,
"vatPercentage": 0.13,
"mrpSrp": 344,
"mrpStatus": true,
"__typename": "SKUPrice"
},
"batchDetails": {
"batchNumber": "DEFAULT_BATCH",
"__typename": "SKUBatch"
},
"usageDate": {
"manufacture": "0000-00-00",
"expiry": "0000-00-00",
"__typename": "SKUUsage"
},
"updatedAt": "2018-01-31",
"active": true,
"__typename": "SKUBatchRate"
},
"Promotion": {
"id": null,
"title": null,
"type": null,
"scope": null,
"criteria": null,
"__typename": "Promotion"
},
"promotionId": null,
"distributorId": 16,
"__typename": "Line",
"inStock": "INSTOCK",
"freeSku": false,
"focusedSku": true
},
{
"id": 5105802,
"quantity": 40,
"skuId": 769,
"callId": 494281,
"skuBatchId": 733,
"amountDetails": {
"rate": 197.53,
"grossAmount": 8928.356,
"netAmount": 8928.356,
"taxAmount": 1027.156,
"taxableAmount": 7901.2,
"subTotal": 7901.2,
"billDiscount": 0,
"tradeDiscount": 0,
"discountAmount": 0,
"promotionDiscount": 0,
"topUpDiscount": 0,
"__typename": "AmountDetail"
},
"rateDetails": {
"rlp": 197.53,
"rlpWithVat": 223.2089,
"netPrice": 197.53,
"netPriceWithVat": 223.2089,
"__typename": "RateDetail"
},
"SKU": {
"id": 769,
"title": "H&S 2in1 Active Protect 180 ml x 24 [82302894]",
"__typename": "SKU"
},
"SKUBatch": {
"priceDetails": {
"rlp": 197.53,
"dlp": 186.35,
"vatPercentage": 0.13,
"mrpSrp": 250,
"mrpStatus": true,
"__typename": "SKUPrice"
},
"batchDetails": {
"batchNumber": "DEFAULT_BATCH",
"__typename": "SKUBatch"
},
"usageDate": {
"manufacture": "0000-00-00",
"expiry": "0000-00-00",
"__typename": "SKUUsage"
},
"updatedAt": "2019-11-05",
"active": true,
"__typename": "SKUBatchRate"
},
"Promotion": {
"id": null,
"title": null,
"type": null,
"scope": null,
"criteria": null,
"__typename": "Promotion"
},
"promotionId": null,
"distributorId": 16,
"__typename": "Line",
"inStock": "INSTOCK",
"freeSku": false,
"focusedSku": false
}
],
"__typename": "PromotionOrder"
}
]
}
};
const orderDetails = [];
responseBody.data.callOrders.forEach((entry) => {
entry.Lines.forEach(({ id, quantity }) => {
orderDetails.push({ id, quantity });
})
});
const requestBody = {
"operationName": null,
"variables": {
"input": {
"invoiceId": 3683663,
"orderDetails": orderDetails
},
"type": "CatalogDetail"
},
"query": "mutation ($input: DispatchInput!) {\n dispatchInvoice(input: $input) {\n id\n __typename\n }\n}\n"
};
console.log(requestBody);

Related

Not able to fetch the varibale value inside the data key in the response

When i am passing the userName as a variable inside data key in the below request then not able to fetch the value. I got the userName in the Login request response. Here UserName and playerName are the same.
Login Request:
42[
"get_login",
{
"key": "AUEEW891WL",
"socketId":"${sid}",
"username": "",
"avatar": "",
"language": "en",
"playerMove": "",
"joinGame": "",
"replay": 0,
"gameID": 0,
"gameNo": 0,
"data": "&email=llk${counter5}#gmail.com&password=poker",
"players": 0,
"level": "",
"lastAction": "",
"game": "",
"playMoney": 1,
"role": ""
}
]
Response:
42[
"gotLogin",
{
"response": {
"playerId": 25601,
"totalWin": 0,
"points": 0,
"playerName": "673508846384",
"displayName": "llk45",
"playerRank": "Amateur",
"playerBank": "11K",
"playerBankAmount": 11000,
"playerAvatar": "avatar1.jpg",
"playerEmail": "llk45#gmail.com",
"playerLevel": 1,
"playerLevelStr": "Lvl. 1",
"playerLevelPrg": 0,
"playerLevelPoints": 100,
"playerGold": 0,
"playerDealerId": 1,
"playerFbId": "",
"loadVocab": "",
"dailyBonus": 0,
"token": "0a5260592b6efc02d3102c639eac0f60d91ad7de8bf57fa114da179f05bcfa84",
"ip": "182.74.4.226",
"interface": {
"home": [
{
"buttonTitle": "Casino",
"buttonIcon": "casino-icon",
"buttonAction": {
"type": "function",
"name": "loadLobby"
}
},
{
"buttonTitle": "Leagues",
"buttonIcon": "leagues-icon",
"buttonAction": {
"type": "function",
"name": "loadLobby"
}
},
{
"buttonTitle": "Clubs",
"buttonIcon": "clubs-icon",
"buttonAction": {
"type": "function",
"name": "loadLobby"
}
},
{
"buttonTitle": "Cashier",
"buttonIcon": "cashier-icon",
"buttonAction": {
"type": "panel",
"name": "pnlChipStore"
}
},
{
"buttonTitle": "Settings",
"buttonIcon": "settings-icon",
"buttonAction": {
"type": "panel",
"name": "pnlSettings"
}
},
{
"buttonTitle": "Notifications",
"buttonIcon": "notifications-icon",
"buttonAction": {
"type": "panel",
"name": "pnlLevel"
}
}
]
},
"playerCountry": "IN",
"role": 1
}
}
]
Request:
42[
"create_game",
{
"key": "AUEEW891WL",
"socketId":"${sid}",
"username": ${userName}",
"avatar": "avatar17.jpg",
"language": "en",
"playerMove": "",
"joinGame": "",
"replay": 0,
"gameID": 0,
"gameNo": 0,
"data": "&gameID=undefined&game=texas&playMoney=1&gameStyle=private-cashgame&tableName=llkTable${counter1}&rakeRate=0&speed=60&sb=10&bb=20&tablelow=100&tablelimit=1000&videorequired=false&username=${userName}",
"players": 0,
"level": 347,
"lastAction": "",
"game": "",
"playMoney": 1,
"role": "1",
"token":"${token}",
"playerId":"${playerId}"
}
]
Response Request:
42[
"create_game",
{
"key": "AUEEW891WL",
"socketId":"TRV8Rm_jtsqn_BBFAAiM",
"username": "673508846384",
"avatar": "avatar17.jpg",
"language": "en",
"playerMove": "",
"joinGame": "",
"replay": 0,
"gameID": 0,
"gameNo": 0,
"data": "&gameID=undefined&game=texas&playMoney=1&gameStyle=private-cashgame&tableName=llkTable47&rakeRate=0&speed=60&sb=10&bb=20&tablelow=100&tablelimit=1000&videorequired=false&username="673508846384",
"players": 0,
"level": 347,
"lastAction": "",
"game": "",
"playMoney": 1,
"role": "1",
"token":"0a5260592b6efc02d3102c639eac0f60d91ad7de8bf57fa114da179f05bcfa84",
"playerId":"25601"
}
]
Here is the screenshot:
enter image description here
How can i pass this value in the create game request inside the data key to fetch it?
If your ${userName} variable has value (i.e. it was set via User Defined Variables or comes from a Post-Processor or it's from the CSV Data Set Config) - JMeter will send the value in the request.
If the variable doesn't have the value - JMeter will send ${userName}
So double check that the ${userName} variable:
Exists
Has its respective value
It can be done using Debug Sampler and View Results Tree listener combination.

Laravel 5.5 echo unable to listen to channel

I am currently using laravel-echo along with with pusher to set up my channel and broadcast however there seems to be some issues creating the listener onto the channel.
There should be a message on the pusher dashboard indicating that the channel is being listened to when the page is entered but nothing is being displayed
Initializing Echo Listener
$(document).ready(function() {
try{
window.Echo.channel('chat-room')
.listen('scannedQR', (e) => {
console.log("event has been triggered");
alert('event has been triggered');
});
alert('success');
}
catch(e){
console.log(e);
alert(e);
}
}
Bootstrap
import Echo from 'laravel-echo'
window.Pusher = require('pusher-js');
window.Lover = "LOVER!";
window.Echo = new Echo({
broadcaster: 'pusher',
key: 'key',
// cluster: 'mt1',
cluster:'ap1',
encrypted: true
});
Echo Object -> console.log(JSON.safeStringify(window.Echo));
{
"options": {
"broadcaster": "pusher",
"key": key,
"cluster": cluster,
"encrypted": true
},
"connector": {
"_defaultOptions": {
"auth": {
"headers": {
"X-CSRF-TOKEN": "oIywz9kkxhVbl109qOqXMy0NVrUCR5AZlYR5apPc"
}
},
"authEndpoint": "/broadcasting/auth",
"userAuthentication": {
"endpoint": "/broadcasting/user-auth",
"headers": {
"X-CSRF-TOKEN": "oIywz9kkxhVbl109qOqXMy0NVrUCR5AZlYR5apPc"
}
},
"broadcaster": "pusher",
"csrfToken": null,
"host": null,
"key": key,
"namespace": "App.Events",
"cluster": "ap1",
"encrypted": true
},
"pusher": {
"key": key,
"config": {
"activityTimeout": 120000,
"cluster": "ap1",
"httpPath": "/pusher",
"httpPort": 80,
"httpsPort": 443,
"pongTimeout": 30000,
"statsHost": "stats.pusher.com",
"unavailableTimeout": 10000,
"wsPath": "",
"wsPort": 80,
"wssPort": 443,
"enableStats": false,
"httpHost": "sockjs-ap1.pusher.com",
"useTLS": true,
"wsHost": "ws-ap1.pusher.com"
},
"channels": {
"channels": {}
},
"global_emitter": {
"callbacks": {
"_callbacks": {}
},
"global_callbacks": []
},
"sessionID": 299457458,
"timeline": {
"key": key,
"session": 299457458,
"events": [
{
"instances": 1,
"timestamp": 1660358957487
},
{
"state": "connecting",
"timestamp": 1660358957538
},
{
"cached": true,
"transport": "xhr_streaming",
"latency": 410,
"timestamp": 1660358957539
},
{
"cid": 1,
"transport": "xhr_streamings",
"timestamp": 1660358957539
},
{
"cid": 1,
"state": "initialized",
"timestamp": 1660358957539
},
{
"cid": 1,
"state": "connecting",
"timestamp": 1660358957541
},
{
"cid": 1,
"state": "open",
"timestamp": 1660358957974
},
{
"state": "connected",
"params": {
"socket_id": "17356.8786996"
},
"timestamp": 1660358957976
}
],
"options": {
"cluster": cluster,
"features": [
"ws"
],
"params": {},
"limit": 50,
"level": 6,
"version": "7.3.0"
},
"sent": 0,
"uniqueID": 1
},
"connection": {
"callbacks": {
"_callbacks": {
"_connected": [
{},
{}
],
"_message": [
{},
{}
],
"_connecting": [
{},
{}
],
"_disconnected": [
{},
{}
],
"_error": [
{}
]
}
},
"global_callbacks": [],
"state": "connected",
"connection": {
"callbacks": {
"_callbacks": {
"_tls_only": [
{}
],
"_refused": [
{}
],
"_backoff": [
{}
],
"_retry": [
{}
],
"_message": [
{}
],
"_ping": [
{}
],
"_activity": [
{}
],
"_error": [
{}
],
"_closed": [
{}
]
}
},
"global_callbacks": [],
"id": "17356.8786996",
"transport": {
"callbacks": {
"_callbacks": {
"_error": [
{}
],
"_closed": [
{},
{}
],
"_message": [
{}
],
"_activity": [
{}
]
}
},
"global_callbacks": [],
"hooks": {
"urls": {},
"handlesActivityChecks": false,
"supportsPing": true
},
"name": "xhr_streaming",
"priority": 1,
"key": key,
"options": {
"key": key,
"useTLS": true,
"hostNonTLS": "sockjs-ap1.pusher.com:80",
"hostTLS": "sockjs-ap1.pusher.com:443",
"httpPath": "/pusher"
},
"state": "open",
"id": 1,
"socket": {
"hooks": {},
"session": "428/90n18c0a",
"location": {
"base": base,
"queryString": "?protocol=7&client=js&version=7.3.0"
},
"readyState": 1,
"stream": {
"callbacks": {
"_callbacks": {
"_chunk": [
{}
],
"_finished": [
{}
],
"_buffer_too_long": [
{}
]
}
},
"global_callbacks": [],
"hooks": {},
"method": "POST",
"url": url,
"position": 2188,
"xhr": {}
}
}
}
},
"key": key,
"options": {
"activityTimeout": 120000,
"pongTimeout": 30000,
"unavailableTimeout": 10000,
"useTLS": true
},
"usingTLS": true,
"errorCallbacks": {},
"connectionCallbacks": {},
"handshakeCallbacks": {},
"strategy": {
"strategy": {
"strategy": {
"trueBranch": {
"strategies": [
{
"strategies": [
{
"name": "ws",
"priority": 3,
"transport": {
"manager": {
"options": {
"lives": 2,
"minPingDelay": 10000,
"maxPingDelay": 120000
},
"livesLeft": 2
},
"transport": {
"hooks": {
"urls": {},
"handlesActivityChecks": false,
"supportsPing": false
}
},
"minPingDelay": 10000,
"maxPingDelay": 120000
},
"options": {
"key": key,
"useTLS": true,
"hostNonTLS": "ws-ap1.pusher.com:80",
"hostTLS": "ws-ap1.pusher.com:443",
"httpPath": ""
}
}
],
"loop": true,
"failFast": false,
"timeout": 15000,
"timeoutLimit": 60000
},
{
"strategy": {
"trueBranch": {
"strategies": [
{
"trueBranch": {
"strategies": [
{
"strategies": [
{
"trueBranch": {
"name": "xhr_streaming",
"priority": 1,
"transport": {
"manager": {
"options": {
"lives": 2,
"minPingDelay": 10000,
"maxPingDelay": 120000
},
"livesLeft": 2
},
"transport": {},
"minPingDelay": 10000,
"maxPingDelay": 120000
},
"options": {
"key": key,
"useTLS": true,
"hostNonTLS": "sockjs-ap1.pusher.com:80",
"hostTLS": "sockjs-ap1.pusher.com:443",
"httpPath": "/pusher"
}
},
"falseBranch": {
"name": "xdr_streaming",
"priority": 1,
"transport": {
"transport": {
"hooks": {
"urls": {},
"handlesActivityChecks": false,
"supportsPing": true
}
},
"minPingDelay": 10000,
"maxPingDelay": 120000
},
"options": {
"key": key,
"useTLS": true,
"hostNonTLS": "sockjs-ap1.pusher.com:80",
"hostTLS": "sockjs-ap1.pusher.com:443",
"httpPath": "/pusher"
}
}
}
],
"loop": true,
"failFast": false,
"timeout": 15000,
"timeoutLimit": 60000
},
{
"strategy": {
"strategies": [
{
"trueBranch": {
"name": "xhr_polling",
"priority": 1,
"transport": {
"hooks": {
"urls": {},
"handlesActivityChecks": false,
"supportsPing": true
}
},
"options": {
"key": key,
"useTLS": true,
"hostNonTLS": "sockjs-ap1.pusher.com:80",
"hostTLS": "sockjs-ap1.pusher.com:443",
"httpPath": "/pusher"
}
},
"falseBranch": {
"name": "xdr_polling",
"priority": 1,
"transport": {
"hooks": {
"urls": {},
"handlesActivityChecks": false,
"supportsPing": true
}
},
"options": {
"key": key,
"useTLS": true,
"hostNonTLS": "sockjs-ap1.pusher.com:80",
"hostTLS": "sockjs-ap1.pusher.com:443",
"httpPath": "/pusher"
}
}
}
],
"loop": true,
"failFast": false,
"timeout": 15000,
"timeoutLimit": 60000
},
"options": {
"delay": 4000
}
}
]
}
}
],
"loop": true,
"failFast": false,
"timeout": 15000,
"timeoutLimit": 60000
},
"falseBranch": {
"strategies": [
{
"name": "sockjs",
"priority": 1,
"transport": {
"hooks": {
"file": "sockjs",
"urls": {},
"handlesActivityChecks": true,
"supportsPing": false
}
},
"options": {
"key": key,
"useTLS": true,
"hostNonTLS": "sockjs-ap1.pusher.com:80",
"hostTLS": "sockjs-ap1.pusher.com:443",
"httpPath": "/pusher"
}
}
],
"loop": true,
"failFast": false,
"timeout": 15000,
"timeoutLimit": 60000
}
},
"options": {
"delay": 2000
}
}
]
}
}
},
"transports": {
"wss": {
"name": "wss",
"priority": 3,
"transport": {
"minPingDelay": 10000,
"maxPingDelay": 120000
},
"options": {
"key": key,
"useTLS": true,
"hostNonTLS": "ws-ap1.pusher.com:80",
"hostTLS": "ws-ap1.pusher.com:443",
"httpPath": ""
}
}
},
"ttl": 1800000,
"usingTLS": true
},
"runner": null,
"unavailableTimer": {
"timer": null
},
"activityTimeout": 120000,
"activityTimer": {
"timer": 5
},
"socket_id": "17356.8786996"
},
"user": {
"callbacks": {
"_callbacks": {}
},
"global_callbacks": [],
"signin_requested": false,
"user_data": null,
"serverToUserChannel": null
}
},
"channels": {}
}
}
Pusher Dashboard doesn't show that channel is being listened to
EDIT
It currently shows on the pusher dashboard that the channel is being listened to but laravel-echo doesn't catch the event on the front end

The task includes an option with an undefined variable. The error was: 'None' has no attribute fallback_ips.yml'

I had a problem when installing a kubernetes cluster of 3 masters and 6 workers and 1 ingress, I did not find that someone would have a similar problem. "TASK [kubespray-defaults : create fallback_ips_base] *****
fatal: [k8s-worker1]: FAILED! => {"msg": "The task includes an option with an undefined variable. The error was: 'None' has no attribute 'get'\n\nThe error appears to be in '/kubespray/roles/kubespray-defaults/tasks/fallback_ips.yml': line 15, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n- name: create fallback_ips_base\n ^ here\n"}"
Command output printf "$(uname -srm)\n$(cat /etc/os-release)\n"
Linux 3.10.0-1160.62.1.el7.x86_64 x86_64
NAME="CentOS Linux"
VERSION="7 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="7"
PRETTY_NAME="CentOS Linux 7 (Core)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:7"
HOME_URL="https://www.centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"
CENTOS_MANTISBT_PROJECT="CentOS-7"
CENTOS_MANTISBT_PROJECT_VERSION="7"
REDHAT_SUPPORT_PRODUCT="centos"
REDHAT_SUPPORT_PRODUCT_VERSION="7"
ansible --version
ansible 2.10.11
config file = /kubespray/ansible.cfg
configured module search path = ['/kubespray/library']
ansible python module location = /usr/local/lib/python3.6/site-packages/ansible
executable location = /usr/local/bin/ansible
python version = 3.6.8 (default, Nov 16 2020, 16:55:22) [GCC 4.8.5 20150623 (Red Hat 4.8.5-44)]
Version of Python (python --version):
Python 2.7.5
Network plugin used:
flannel
nodes:
k8s-master1 ansible_host=172.16.18.141 ip=172.16.18.141
k8s-master2 ansible_host=172.16.18.133 ip=172.16.18.133
k8s-master3 ansible_host=172.16.18.134 ip=172.16.18.134
k8s-worker1 ansible_host=172.16.18.135 ip=172.16.18.135
k8s-worker2 ansible_host=172.16.18.136 ip=172.16.18.136
k8s-worker3 ansible_host=172.16.18.137 ip=172.16.18.137
k8s-worker4 ansible_host=172.16.18.138 ip=172.16.18.138
k8s-worker5 ansible_host=172.16.18.140 ip=172.16.18.140
k8s-worker6 ansible_host=172.16.18.139 ip=172.16.18.139
k8s-ingress ansible_host=172.16.18.142 ip=172.16.18.142
[kube_control_plane]
k8s-master1
k8s-master2
k8s-master3
[etcd]
k8s-master2
k8s-master3
k8s-master1
[kube_node]
k8s-worker1
k8s-worker2
k8s-worker3
k8s-worker4
k8s-worker5
k8s-worker6
k8s-ingress
[kube_ingress]
k8s-ingress
[k8s_cluster:children]
kube_node
kube_control_plane
ansible -m setup:
k8s-worker1 | SUCCESS => {
"ansible_facts": {
"ansible_apparmor": {
"status": "disabled"
},
"ansible_architecture": "x86_64",
"ansible_bios_date": "09/17/2015",
"ansible_bios_vendor": "Phoenix Technologies LTD",
"ansible_bios_version": "6.00",
"ansible_board_asset_tag": "NA",
"ansible_board_name": "440BX Desktop Reference Platform",
"ansible_board_serial": "None",
"ansible_board_vendor": "Intel Corporation",
"ansible_board_version": "None",
"ansible_chassis_asset_tag": "No Asset Tag",
"ansible_chassis_serial": "None",
"ansible_chassis_vendor": "No Enclosure",
"ansible_chassis_version": "N/A",
"ansible_cmdline": {
"BOOT_IMAGE": "/vmlinuz-3.10.0-1160.62.1.el7.x86_64",
"LANG": "en_US.UTF-8",
"crashkernel": "auto",
"quiet": true,
"rd.lvm.lv": "centos/swap",
"rhgb": true,
"ro": true,
"root": "/dev/mapper/centos-root"
},
"ansible_date_time": {
"date": "2022-06-02",
"day": "02",
"epoch": "1654127793",
"hour": "02",
"iso8601": "2022-06-01T23:56:33Z",
"iso8601_basic": "20220602T025633575892",
"iso8601_basic_short": "20220602T025633",
"iso8601_micro": "2022-06-01T23:56:33.575892Z",
"minute": "56",
"month": "06",
"second": "33",
"time": "02:56:33",
"tz": "IDT",
"tz_offset": "+0300",
"weekday": "Thursday",
"weekday_number": "4",
"weeknumber": "22",
"year": "2022"
},
"ansible_device_links": {
"ids": {
"dm-0": [
"dm-name-centos-root",
"dm-uuid-LVM-eq8RdwDh8UmVbxUDFSJojOlSDEbBTzsro1ok8rizmZLLezdQlepE8PQGLJUrOxrb"
],
"dm-1": [
"dm-name-centos-swap",
"dm-uuid-LVM-eq8RdwDh8UmVbxUDFSJojOlSDEbBTzsrRm5FHwbU4faE1weTgRbY2xdwQJs5YPpJ"
],
"dm-2": [
"dm-name-centos-home",
"dm-uuid-LVM-eq8RdwDh8UmVbxUDFSJojOlSDEbBTzsr0wXP3uZEc9Ld1tvj3Cx9dKlN4MhfsbBF"
],
"sda2": [
"lvm-pv-uuid-J3cGFq-UpST-uNKu-8iTN-iWep-Kpxo-Sokz40"
],
"sr0": [
"ata-VMware_Virtual_SATA_CDRW_Drive_00000000000000000001"
]
},
"labels": {},
"masters": {
"sda2": [
"dm-0",
"dm-1",
"dm-2"
]
},
"uuids": {
"dm-0": [
"cdd909fe-d39a-4ea9-8959-fe1aca72a2e8"
],
"dm-1": [
"52b08951-ea16-4abe-8315-35a4261eaef7"
],
"dm-2": [
"18ecd858-0042-4e4d-8c9d-f15236a1c9c7"
],
"sda1": [
"11285025-905b-4798-8560-d1d8900fc90c"
]
}
},
"ansible_devices": {
"dm-0": {
"holders": [],
"host": "",
"links": {
"ids": [
"dm-name-centos-root",
"dm-uuid-LVM-eq8RdwDh8UmVbxUDFSJojOlSDEbBTzsro1ok8rizmZLLezdQlepE8PQGLJUrOxrb"
],
"labels": [],
"masters": [],
"uuids": [
"cdd909fe-d39a-4ea9-8959-fe1aca72a2e8"
]
},
"model": null,
"partitions": {},
"removable": "0",
"rotational": "1",
"sas_address": null,
"sas_device_handle": null,
"scheduler_mode": "",
"sectors": "104857600",
"sectorsize": "512",
"size": "50.00 GB",
"support_discard": "0",
"vendor": null,
"virtual": 1
},
"dm-1": {
"holders": [],
"host": "",
"links": {
"ids": [
"dm-name-centos-swap",
"dm-uuid-LVM-eq8RdwDh8UmVbxUDFSJojOlSDEbBTzsrRm5FHwbU4faE1weTgRbY2xdwQJs5YPpJ"
],
"labels": [],
"masters": [],
"uuids": [
"52b08951-ea16-4abe-8315-35a4261eaef7"
]
},
"model": null,
"partitions": {},
"removable": "0",
"rotational": "1",
"sas_address": null,
"sas_device_handle": null,
"scheduler_mode": "",
"sectors": "12320768",
"sectorsize": "512",
"size": "5.88 GB",
"support_discard": "0",
"vendor": null,
"virtual": 1
},
"dm-2": {
"holders": [],
"host": "",
"links": {
"ids": [
"dm-name-centos-home",
"dm-uuid-LVM-eq8RdwDh8UmVbxUDFSJojOlSDEbBTzsr0wXP3uZEc9Ld1tvj3Cx9dKlN4MhfsbBF"
],
"labels": [],
"masters": [],
"uuids": [
"18ecd858-0042-4e4d-8c9d-f15236a1c9c7"
]
},
"model": null,
"partitions": {},
"removable": "0",
"rotational": "1",
"sas_address": null,
"sas_device_handle": null,
"scheduler_mode": "",
"sectors": "90423296",
"sectorsize": "512",
"size": "43.12 GB",
"support_discard": "0",
"vendor": null,
"virtual": 1
},
"fd0": {
"holders": [],
"host": "",
"links": {
"ids": [],
"labels": [],
"masters": [],
"uuids": []
},
"model": null,
"partitions": {},
"removable": "1",
"rotational": "1",
"sas_address": null,
"sas_device_handle": null,
"scheduler_mode": "deadline",
"sectors": "8",
"sectorsize": "512",
"size": "4.00 KB",
"support_discard": "0",
"vendor": null,
"virtual": 1
},
"sda": {
"holders": [],
"host": "",
"links": {
"ids": [],
"labels": [],
"masters": [],
"uuids": []
},
"model": "Virtual disk",
"partitions": {
"sda1": {
"holders": [],
"links": {
"ids": [],
"labels": [],
"masters": [],
"uuids": [
"11285025-905b-4798-8560-d1d8900fc90c"
]
},
"sectors": "2097152",
"sectorsize": 512,
"size": "1.00 GB",
"start": "2048",
"uuid": "11285025-905b-4798-8560-d1d8900fc90c"
},
"sda2": {
"holders": [
"centos-root",
"centos-swap",
"centos-home"
],
"links": {
"ids": [
"lvm-pv-uuid-J3cGFq-UpST-uNKu-8iTN-iWep-Kpxo-Sokz40"
],
"labels": [],
"masters": [
"dm-0",
"dm-1",
"dm-2"
],
"uuids": []
},
"sectors": "207616000",
"sectorsize": 512,
"size": "99.00 GB",
"start": "2099200",
"uuid": null
}
},
"removable": "0",
"rotational": "1",
"sas_address": null,
"sas_device_handle": null,
"scheduler_mode": "deadline",
"sectors": "209715200",
"sectorsize": "512",
"size": "100.00 GB",
"support_discard": "0",
"vendor": "VMware",
"virtual": 1
},
"sr0": {
"holders": [],
"host": "",
"links": {
"ids": [
"ata-VMware_Virtual_SATA_CDRW_Drive_00000000000000000001"
],
"labels": [],
"masters": [],
"uuids": []
},
"model": "VMware SATA CD00",
"partitions": {},
"removable": "1",
"rotational": "1",
"sas_address": null,
"sas_device_handle": null,
"scheduler_mode": "deadline",
"sectors": "2097151",
"sectorsize": "512",
"size": "1024.00 MB",
"support_discard": "0",
"vendor": "NECVMWar",
"virtual": 1
}
},
"ansible_distribution": "CentOS",
"ansible_distribution_file_parsed": true,
"ansible_distribution_file_path": "/etc/redhat-release",
"ansible_distribution_file_variety": "RedHat",
"ansible_distribution_major_version": "7",
"ansible_distribution_release": "Core",
"ansible_distribution_version": "7.9",
"ansible_dns": {
"nameservers": [
"172.16.1.1"
]
},
"ansible_domain": "s000.local",
"ansible_effective_group_id": 0,
"ansible_effective_user_id": 0,
"ansible_env": {
"HOME": "/root",
"LANG": "C",
"LC_ALL": "C",
"LC_NUMERIC": "C",
"LESSOPEN": "||/usr/bin/lesspipe.sh %s",
"LOGNAME": "root",
"MAIL": "/var/mail/root",
"PATH": "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin",
"PWD": "/root",
"SELINUX_LEVEL_REQUESTED": "",
"SELINUX_ROLE_REQUESTED": "",
"SELINUX_USE_CURRENT_RANGE": "",
"SHELL": "/bin/bash",
"SHLVL": "2",
"SSH_CLIENT": "172.16.18.131 42184 22",
"SSH_CONNECTION": "172.16.18.131 42184 172.16.18.135 22",
"USER": "root",
"XDG_RUNTIME_DIR": "/run/user/0",
"XDG_SESSION_ID": "19",
"_": "/usr/bin/python"
},
"ansible_fibre_channel_wwn": [],
"ansible_fips": false,
"ansible_form_factor": "Other",
"ansible_fqdn": "k8s-worker1.s000.local",
"ansible_hostname": "k8s-worker1",
"ansible_hostnqn": "",
"ansible_is_chroot": false,
"ansible_iscsi_iqn": "",
"ansible_kernel": "3.10.0-1160.62.1.el7.x86_64",
"ansible_kernel_version": "#1 SMP Tue Apr 5 16:57:59 UTC 2022",
"ansible_local": {},
"ansible_lsb": {},
"ansible_lvm": {
"lvs": {
"home": {
"size_g": "43.12",
"vg": "centos"
},
"root": {
"size_g": "50.00",
"vg": "centos"
},
"swap": {
"size_g": "5.88",
"vg": "centos"
}
},
"pvs": {
"/dev/sda2": {
"free_g": "0.00",
"size_g": "99.00",
"vg": "centos"
}
},
"vgs": {
"centos": {
"free_g": "0.00",
"num_lvs": "3",
"num_pvs": "1",
"size_g": "99.00"
}
}
},
"ansible_machine": "x86_64",
"ansible_machine_id": "32496b187f444d3b95eeafeb0fce0cae",
"ansible_memfree_mb": 5297,
"ansible_memory_mb": {
"nocache": {
"free": 5508,
"used": 297
},
"real": {
"free": 5297,
"total": 5805,
"used": 508
},
"swap": {
"cached": 0,
"free": 0,
"total": 0,
"used": 0
}
},
"ansible_memtotal_mb": 5805,
"ansible_mounts": [
{
"block_available": 210041,
"block_size": 4096,
"block_total": 259584,
"block_used": 49543,
"device": "/dev/sda1",
"fstype": "xfs",
"inode_available": 523954,
"inode_total": 524288,
"inode_used": 334,
"mount": "/boot",
"options": "rw,seclabel,relatime,attr2,inode64,noquota",
"size_available": 860327936,
"size_total": 1063256064,
"uuid": "11285025-905b-4798-8560-d1d8900fc90c"
},
{
"block_available": 12278107,
"block_size": 4096,
"block_total": 13100800,
"block_used": 822693,
"device": "/dev/mapper/centos-root",
"fstype": "xfs",
"inode_available": 26161376,
"inode_total": 26214400,
"inode_used": 53024,
"mount": "/",
"options": "rw,seclabel,relatime,attr2,inode64,noquota",
"size_available": 50291126272,
"size_total": 53660876800,
"uuid": "cdd909fe-d39a-4ea9-8959-fe1aca72a2e8"
},
{
"block_available": 11289145,
"block_size": 4096,
"block_total": 11297393,
"block_used": 8248,
"device": "/dev/mapper/centos-home",
"fstype": "xfs",
"inode_available": 22605821,
"inode_total": 22605824,
"inode_used": 3,
"mount": "/home",
"options": "rw,seclabel,relatime,attr2,inode64,noquota",
"size_available": 46240337920,
"size_total": 46274121728,
"uuid": "18ecd858-0042-4e4d-8c9d-f15236a1c9c7"
}
],
"ansible_nodename": "k8s-worker1",
"ansible_os_family": "RedHat",
"ansible_pkg_mgr": "yum",
"ansible_proc_cmdline": {
"BOOT_IMAGE": "/vmlinuz-3.10.0-1160.62.1.el7.x86_64",
"LANG": "en_US.UTF-8",
"crashkernel": "auto",
"quiet": true,
"rd.lvm.lv": [
"centos/root",
"centos/swap"
],
"rhgb": true,
"ro": true,
"root": "/dev/mapper/centos-root"
},
"ansible_processor": [
"0",
"GenuineIntel",
"Intel(R) Xeon(R) CPU E5-2650 v2 # 2.60GHz",
"1",
"GenuineIntel",
"Intel(R) Xeon(R) CPU E5-2650 v2 # 2.60GHz",
"2",
"GenuineIntel",
"Intel(R) Xeon(R) CPU E5-2650 v2 # 2.60GHz",
"3",
"GenuineIntel",
"Intel(R) Xeon(R) CPU E5-2650 v2 # 2.60GHz"
],
"ansible_processor_cores": 1,
"ansible_processor_count": 4,
"ansible_processor_nproc": 4,
"ansible_processor_threads_per_core": 1,
"ansible_processor_vcpus": 4,
"ansible_product_name": "VMware Virtual Platform",
"ansible_product_serial": "VMware-56 4d f7 52 8a 2f 19 11-ea 9d 2f c8 ed 50 ef 3e",
"ansible_product_uuid": "564DF752-8A2F-1911-EA9D-2FC8ED50EF3E",
"ansible_product_version": "None",
"ansible_python": {
"executable": "/usr/bin/python",
"has_sslcontext": true,
"type": "CPython",
"version": {
"major": 2,
"micro": 5,
"minor": 7,
"releaselevel": "final",
"serial": 0
},
"version_info": [
2,
7,
5,
"final",
0
]
},
"ansible_python_version": "2.7.5",
"ansible_real_group_id": 0,
"ansible_real_user_id": 0,
"ansible_selinux": {
"config_mode": "permissive",
"mode": "permissive",
"policyvers": 31,
"status": "enabled",
"type": "targeted"
},
"ansible_selinux_python_present": true,
"ansible_service_mgr": "systemd",
"ansible_ssh_host_key_ecdsa_public": "AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBHqsSpmuUFd15ttkWjkpvPgflGaP1ESchUZA8MI0CTviJIHUCz2h3mH1PMTMZwqnaAkdOp1sJQjT09omvBBets0=",
"ansible_ssh_host_key_ecdsa_public_keytype": "ecdsa-sha2-nistp256",
"ansible_ssh_host_key_ed25519_public": "AAAAC3NzaC1lZDI1NTE5AAAAIEaCutePk/HnsQX6kFpBZxPqCIfF8i7kYnj5xRQjBI6A",
"ansible_ssh_host_key_ed25519_public_keytype": "ssh-ed25519",
"ansible_ssh_host_key_rsa_public": "AAAAB3NzaC1yc2EAAAADAQABAAABAQDAzM6HtHaQKXZEZ127SSzfLkr4WEz2EGWdTRKZJCQWsxwJmMckWOP7gaC5jHEQ50pu03BH0JrSq9sH4mBuxkB7tudsEMruoSYmfODvrJ39aQDTtDCbrtCvXWLcFmtwfpawrN2FrsqMz7wrvcfSR/t8Nmx3eRtuSXhFTj30mQJ9bEUQHuL3+BGrjaJArzFVWvbkvuPFn1nvAYdoXwSGrBIFq6vVNyA+1IIt3bZH1ZRMwPxCqQ2xxZA8nRnxGSpaZaNN9DiM+64Z1goTzFAXZXRDpx2YqyDF7vImNRpuJFNTCHpCHTbFWVjBre51HAgJoTLen+LafiF52elaGTgS+H6l",
"ansible_ssh_host_key_rsa_public_keytype": "ssh-rsa",
"ansible_swapfree_mb": 0,
"ansible_swaptotal_mb": 0,
"ansible_system": "Linux",
"ansible_system_capabilities": [
"cap_chown",
"cap_dac_override",
"cap_dac_read_search",
"cap_fowner",
"cap_fsetid",
"cap_kill",
"cap_setgid",
"cap_setuid",
"cap_setpcap",
"cap_linux_immutable",
"cap_net_bind_service",
"cap_net_broadcast",
"cap_net_admin",
"cap_net_raw",
"cap_ipc_lock",
"cap_ipc_owner",
"cap_sys_module",
"cap_sys_rawio",
"cap_sys_chroot",
"cap_sys_ptrace",
"cap_sys_pacct",
"cap_sys_admin",
"cap_sys_boot",
"cap_sys_nice",
"cap_sys_resource",
"cap_sys_time",
"cap_sys_tty_config",
"cap_mknod",
"cap_lease",
"cap_audit_write",
"cap_audit_control",
"cap_setfcap",
"cap_mac_override",
"cap_mac_admin",
"cap_syslog",
"35",
"36+ep"
],
"ansible_system_capabilities_enforced": "True",
"ansible_system_vendor": "VMware, Inc.",
"ansible_uptime_seconds": 56108,
"ansible_user_dir": "/root",
"ansible_user_gecos": "root",
"ansible_user_gid": 0,
"ansible_user_id": "root",
"ansible_user_shell": "/bin/bash",
"ansible_user_uid": 0,
"ansible_userspace_architecture": "x86_64",
"ansible_userspace_bits": "64",
"ansible_virtualization_role": "guest",
"ansible_virtualization_type": "VMware",
"gather_subset": [
"all"
],
"module_setup": true
},
"changed": false
}

How to filter laravel collection from given data

i have a collection data
{
"success": true,
"doctor": [
{
"id": 1,
"name": "Dr. Mayank",
"dob": "1975-01-01",
"about": "This is description",
"status": 1,
"rating": 2,
"rating_given_by": 1,
"alternative_number": "7686876876",
"profile_photo": [],
"speciality": [
{
"id": 3,
"name": "Acupuncture",
"image": null,
"dashboard_flag": 1
},
{
"id": 4,
"name": "Acupuncturist",
"image": null,
"dashboard_flag": 1
},
{
"id": 1,
"name": "Accident and emergency medicine",
"image": "http://192.168.16.21/remidify/media/174/detail.png",
"dashboard_flag": 1
}
],
"service": [
{
"id": 78,
"name": "Correction of gummy smile",
"cost": "12.00"
},
{
"id": 77,
"name": "Dental aesthetics",
"cost": "43.00"
}
],
"clinics": [
{
"id": 1,
"name": "akram",
"entity_id": 1,
"entity_type": "App\Doctor",
"contact_number": "2132132132132",
"status": 0,
"consultancy_fee": "12.00",
"available_today": "No",
"owner_name": "Dr. Mayank",
"pivot": {
"doctor_id": 1,
"clinic_id": 1
},
"address": {
"id": 1,
"address_1": "asdasdasdsa",
"address_2": "",
"locality": "downtown",
"city": "noida",
"state": "up",
"postal_code": "41561566"
},
"speciality": [],
"service": [
{
"id": 11,
"name": "Laminates",
"cost": "20.00"
},
{
"id": 12,
"name": "Dental surgery",
"cost": "300.00"
}
],
"clinic_image": [
{
"id": 7,
"model_id": 1,
"model_type": "App\Clinic",
"collection_name": "clinic_image",
"file_name": "1494863957588.566162.jpg",
"disk": "media",
"url": "http://192.168.16.21/remidify/media/7/1494863957588.566162.jpg"
}
],
"id_image": [
{
"id": 8,
"model_id": 1,
"model_type": "App\Clinic",
"collection_name": "id_image",
"file_name": "1494863966218.348877.jpg",
"disk": "media",
"url": "http://192.168.16.21/remidify/media/8/1494863966218.348877.jpg"
}
],
"location": {
"id": 1,
"latitude": 0,
"longitude": 0,
"entity_id": 1,
"entity_type": "App\Clinic",
"created_at": "2017-05-16 03:00:10",
"updated_at": "2017-05-16 03:00:10"
},
"clinic_timings": [
{
"day": "sun",
"opens_at": "09:28:00",
"closes_at": "21:28:00"
}
]
}
],
"education": [
{
"id": 19,
"degree": "MBBS",
"university": "Univercity",
"year": "2017",
"entity_id": 1,
"entity_type": "App\Doctor",
"created_at": "2017-05-16 05:44:11",
"updated_at": "2017-05-16 05:44:11",
"location": "Delhi"
}
],
"experience": [
{
"id": 19,
"hospital": "Hospital name",
"post": "pta ni hai",
"from": "1970-01-01",
"to": "0000-00-00",
"entity_id": 1,
"entity_type": "App\Doctor",
"created_at": "2017-05-16 05:44:12",
"updated_at": "2017-05-16 05:44:12",
"location": "Locations12",
"is_currently_working": 1
}
],
"registration": {
"id": 1,
"registration_number": "Reg # 2324324",
"registration_year": 1975,
"registration_council": "Council",
"experience": null,
"doctor_id": 1,
"created_at": "2017-05-16 02:56:37",
"updated_at": "2017-05-16 02:56:37",
"adhaar_number": "232131231232",
"id_proof": [
{
"id": 2,
"model_id": 1,
"model_type": "App\DoctorRegistration",
"collection_name": "id_proof",
"file_name": "1494863680447.329102.jpg",
"disk": "media",
"url": "http://192.168.16.21/remidify/media/2/1494863680447.329102.jpg"
}
],
"registration_proof": [
{
"id": 3,
"model_id": 1,
"model_type": "App\DoctorRegistration",
"collection_name": "registration_proof",
"file_name": "1494863687436.266846.jpg",
"disk": "media",
"url": "http://192.168.16.21/remidify/media/3/1494863687436.266846.jpg"
}
],
"qualification_proof": [
{
"id": 4,
"model_id": 1,
"model_type": "App\DoctorRegistration",
"collection_name": "qualification_proof",
"file_name": "1494863695576.803955.jpg",
"disk": "media",
"url": "http://192.168.16.21/remidify/media/4/1494863695576.803955.jpg"
}
]
},
"preference": {
"availability": 1,
"appointment_confirmation_method": "manual",
"average_time": 7,
"holiday_from": null,
"holiday_till": null,
"patients_per_hour": null,
"preferred_appointment_type": "timeslot",
"appointment_frequency": null,
"preferred_payment_method": [
{
"payment_method": "cash"
},
{
"payment_method": "online"
}
]
},
"user": null,
"doctor_clinic": [
{
"doctor_id": 1,
"clinic_id": 1,
"consultancy_fee": "12.00",
"deleted_at": null,
"workdays": [
{
"day": "sun",
"available": 1,
"workhours": [
{
"from": "09:28:00",
"to": "21:28:00"
}
]
}
],
"service": []
}
]
}
]
}
Now how can i find the doctors whose "about or specialty name" matches with some given search string.
Thanks in advance.
Try using dd() helper and use like this below
$youcollectionvariables = { "success": true, "doctor": [ { "id": 1, "name": "Dr. Mayank", "dob": "1975-01-01"................. }
dd($youcollectionvariables)
you will see a formatted data and can find what you need clearly.
Hope that helps.

Create hive table for JSON data

How to create hive table for the below twitter JSON data that is available in HDFS path. I tried some of the query from the web to create the table, but facing some issue.
{
"extended_entities": {
"media": [{
"display_url": "pic.twitter.com/9SoA83sVvP",
"indices": [100, 123],
"sizes": {
"small": {
"w": 340,
"h": 340,
"resize": "fit"
},
"large": {
"w": 480,
"h": 480,
"resize": "fit"
},
"thumb": {
"w": 150,
"h": 150,
"resize": "crop"
},
"medium": {
"w": 480,
"h": 480,
"resize": "fit"
}
},
"id_str": "685710180164579329",
"expanded_url": "http://twitter.com/add7dave/status/685710518456209408/video/1",
"media_url_https": "https://pbs.twimg.com/ext_tw_video_thumb/685710180164579329/pu/img/4wOqavTprNIaMgjK.jpg",
"id": 685710180164579329,
"type": "video",
"media_url": "http://pbs.twimg.com/ext_tw_video_thumb/685710180164579329/pu/img/4wOqavTprNIaMgjK.jpg",
"url": "https://t.co/9SoA83sVvP",
"video_info": {
"aspect_ratio": [1, 1],
"duration_millis": 7567,
"variants": [{
"content_type": "application/x-mpegURL",
"url": "https://video.twimg.com/ext_tw_video/685710180164579329/pu/pl/6JnchC_1FWviydJV.m3u8"
}, {
"content_type": "application/dash+xml",
"url": "https://video.twimg.com/ext_tw_video/685710180164579329/pu/pl/6JnchC_1FWviydJV.mpd"
}, {
"content_type": "video/mp4",
"bitrate": 320000,
"url": "https://video.twimg.com/ext_tw_video/685710180164579329/pu/vid/240x240/W7suov-YC1Iq1-QT.mp4"
}, {
"content_type": "video/webm",
"bitrate": 832000,
"url": "https://video.twimg.com/ext_tw_video/685710180164579329/pu/vid/480x480/bDG_UfEw3jBM7z4e.webm"
}, {
"content_type": "video/mp4",
"bitrate": 832000,
"url": "https://video.twimg.com/ext_tw_video/685710180164579329/pu/vid/480x480/bDG_UfEw3jBM7z4e.mp4"
}]
}
}]
},
"in_reply_to_status_id_str": null,
"in_reply_to_status_id": null,
"created_at": "Sat Jan 09 06:31:42 +0000 2016",
"in_reply_to_user_id_str": null,
"source": "<a href=\"http://twitter.com/download/android\" rel=\"nofollow\">Twitter for Android<\/a>",
"retweet_count": 0,
"retweeted": false,
"geo": null,
"filter_level": "low",
"in_reply_to_screen_name": null,
"is_quote_status": false,
"id_str": "685710518456209408",
"in_reply_to_user_id": null,
"favorite_count": 0,
"id": 685710518456209408,
"text": "New video NO-17\n#BritanniaFilmfareAwards\n#GoodDayCookies\n#BritanniaIndLtd\nAmitabh Bachchan dialogue https://t.co/9SoA83sVvP",
"place": null,
"lang": "en",
"favorited": false,
"possibly_sensitive": false,
"coordinates": null,
"truncated": false,
"timestamp_ms": "1452321102142",
"entities": {
"urls": [],
"hashtags": [{
"indices": [16, 40],
"text": "BritanniaFilmfareAwards"
}],
"media": [{
"display_url": "pic.twitter.com/9SoA83sVvP",
"indices": [100, 123],
"sizes": {
"small": {
"w": 340,
"h": 340,
"resize": "fit"
},
"large": {
"w": 480,
"h": 480,
"resize": "fit"
},
"thumb": {
"w": 150,
"h": 150,
"resize": "crop"
},
"medium": {
"w": 480,
"h": 480,
"resize": "fit"
}
},
"id_str": "685710180164579329",
"expanded_url": "http://twitter.com/add7dave/status/685710518456209408/video/1",
"media_url_https": "https://pbs.twimg.com/ext_tw_video_thumb/685710180164579329/pu/img/4wOqavTprNIaMgjK.jpg",
"id": 685710180164579329,
"type": "photo",
"media_url": "http://pbs.twimg.com/ext_tw_video_thumb/685710180164579329/pu/img/4wOqavTprNIaMgjK.jpg",
"url": "https://t.co/9SoA83sVvP"
}],
"user_mentions": [{
"indices": [41, 56],
"screen_name": "GoodDayCookies",
"id_str": "2197439803",
"name": "Britannia Good Day",
"id": 2197439803
}, {
"indices": [57, 73],
"screen_name": "BritanniaIndLtd",
"id_str": "3281245460",
"name": "Britannia Industries",
"id": 3281245460
}],
"symbols": []
},
"contributors": null,
"user": {
"utc_offset": 19800,
"friends_count": 1517,
"profile_image_url_https": "https://pbs.twimg.com/profile_images/593327096736256001/TT8Ds75__normal.jpg",
"listed_count": 1,
"profile_background_image_url": "http://abs.twimg.com/images/themes/theme19/bg.gif",
"default_profile_image": false,
"favourites_count": 25,
"description": "Sharukhan, Kapil sharma , Narendra modi Fan (Supporter) be happy *↓*",
"created_at": "Thu Sep 15 08:04:58 +0000 2011",
"is_translator": false,
"profile_background_image_url_https": "https://abs.twimg.com/images/themes/theme19/bg.gif",
"protected": false,
"screen_name": "add7dave",
"id_str": "373836462",
"profile_link_color": "9266CC",
"id": 373836462,
"geo_enabled": false,
"profile_background_color": "FFF04D",
"lang": "en",
"profile_sidebar_border_color": "000000",
"profile_text_color": "000000",
"verified": false,
"profile_image_url": "http://pbs.twimg.com/profile_images/593327096736256001/TT8Ds75__normal.jpg",
"time_zone": "Chennai",
"url": null,
"contributors_enabled": false,
"profile_background_tile": false,
"profile_banner_url": "https://pbs.twimg.com/profile_banners/373836462/1428993069",
"statuses_count": 21397,
"follow_request_sent": null,
"followers_count": 438,
"profile_use_background_image": true,
"default_profile": false,
"following": null,
"name": "aditya dave",
"location": "Bhavnagar, Gujarat",
"profile_sidebar_fill_color": "000000",
"notifications": null
}
}
I tried the below table but it gives error.
hive> CREATE EXTERNAL TABLE tweets (
id BIGINT,
created_at STRING,
source STRING,
favorited BOOLEAN,
retweeted_status STRUCT<
text:STRING,
user:STRUCT<screen_name:STRING,name:STRING>,
retweet_count:INT>,
entities STRUCT<
urls:ARRAY<STRUCT<expanded_url:STRING>>,
user_mentions:ARRAY<STRUCT<screen_name:STRING,name:STRING>>,
hashtags:ARRAY<STRUCT<text:STRING>>>,
text STRING,
user STRUCT<
screen_name:STRING,
name:STRING,
friends_count:INT,
followers_count:INT,
statuses_count:INT,
verified:BOOLEAN,
utc_offset:INT,
time_zone:STRING>,
in_reply_to_screen_name STRING
)
PARTITIONED BY (datehour INT)
ROW FORMAT SERDE 'com.cloudera.hive.serde.JSONSerDe'
LOCATION '/user/flume/tweets/01092015';
You can use this utility https://github.com/quux00/hive-json-schema to create a hive schema from JSON. But as Ben Watson in his answer here if there are some columns like user that use a reserved name, you have to either enclose them with backticks or use a serde like https://github.com/rcongiu/Hive-JSON-Serde that can map hive columns to json elements.

Resources