I am passing a post request to Insomnia via the REST API to an arbitrary record type.
Title goes well and has the following structure
name: title value : Hello world
But the ACF fields come empty
I add to the request
name: poleacf, and value: Field text
But I only get the name and the fields come empty
This is how the structure looks like:
"id": 242,
"date": "2022-08-24T12:34:44",
"date_gmt": "2022-08-24T09:34:44",
"guid": {
"rendered": "https:\/\/mymerro.xn----gtbemkpb3brp9h.xn--p1ai\/?post_type=reviews&p=242",
"raw": "https:\/\/mymerro.xn----gtbemkpb3brp9h.xn--p1ai\/?post_type=reviews&p=242"
},
"modified": "2022-08-24T12:34:44",
"modified_gmt": "2022-08-24T09:34:44",
"password": "",
"slug": "",
"status": "draft",
"type": "reviews",
"link": "/?post_type=reviews&p=242",
"title": {
"raw": "Привет",
"rendered": "Привет"
},
"featured_media": 0,
"template": "",
"meta": {
"inline_featured_image": false
},
"permalink_template": "https:\/\/mymerro.xn----gtbemkpb3brp9h.xn--p1ai\/reviews\/%pagename%\/",
"generated_slug": "privet",
"acf": {
"opisanie": null,
"nazvanie_sobytiya": null,
"nazvanie_kompanii": null,
"otzyv_aktiven": null,
"oczenka": null,
"autor": null
},
Please help me correctly register the QUERY values in Insomnia so that the fields with ACF also do not come empty
Related
hi I am using google api to get all the events which is working fine. There is a parameter where I can specify fields name which I need to retrieve. There is a filed named as items where all the events data are coming. Now I want to get specific data of that items filed. Not all the data.
This is how I am getting all the data of that items.
https://www.googleapis.com/calendar/v3/calendars/CALENDAR_ID/events?showDeleted=true&timeMax=2021-08-16T06%3A00%3A46.000Z&timeMin=2021-04-16T06%3A00%3A46.000Z&prettyPrint=true&fields=items&key=[YOUR_API_KEY]
This is how data are coming.
{
"items": [
{
"kind": "calendar#event",
"etag": "\"hfsfjadj\"",
"id": "adfjadfjad",
"status": "confirmed",
"htmlLink": "https://www.google.com/calendar/event?eid=adfjdafjd",
"created": "2021-05-24T05:47:42.000Z",
"updated": "2021-05-24T05:47:42.331Z",
"summary": "dafhafj",
"creator": {
"email": "adfjadfj#gmail.com",
"self": true
},
"organizer": {
"email": "adfjadfj#gmail.com",
"self": true
},
"start": {
"dateTime": "2021-05-24T11:30:00+06:00"
},
"end": {
"dateTime": "2021-05-24T12:30:00+06:00"
},
"iCalUID": "dfjdfjdfj#google.com",
"sequence": 0,
"reminders": {
"useDefault": true
},
"eventType": "default"
}
]
}
I wanted to fetch only id, start,end and summary not the entire thing which is given above.
You can specify nested fields by enclosing them in round brackets, and multiple fields should be separated by commas. Your provided fields would be something like this:
items(id,start,end,summary)
Therefore, the URL would change from this:
https://www.googleapis.com/calendar/v3/calendars/CALENDAR_ID/events?showDeleted=true&timeMax=2021-08-16T06%3A00%3A46.000Z&timeMin=2021-04-16T06%3A00%3A46.000Z&prettyPrint=true&fields=items&key=[YOUR_API_KEY]
To this:
https://www.googleapis.com/calendar/v3/calendars/CALENDAR_ID/events?showDeleted=true&timeMax=2021-08-16T06%3A00%3A46.000Z&timeMin=2021-04-16T06%3A00%3A46.000Z&prettyPrint=true&fields=items(id%2Cstart%2Cend%2Csummary)&key=[YOUR_API_KEY]
Reference:
Partial response
I've been using the Herepy package for using the Here Maps API on python and I finally managed to get some of the results. I'm having a hard time accessing the next page of results in the PlacesResponse I got.
Code:
response = geocoderApi.onebox_search([12.8797, 121.7740], 'mall')
Result:
{'results': {'next': 'https://places.ls.hereapi.com/places/v1/discover/search;context=Zmxvdy1pZD1jNDhkZGI5ZC1hY2E0LTU3MDctOTEzOS1jOTk3MmU1NWFkNDdfMTU3OTIzNDM1MjU3N18xNDM1XzQ2MzAmb2Zmc2V0PTIwJnNpemU9MjA?at=12.8797%2C121.774&q=mall','items': [{'position': [12.57726, 122.26888],
'distance': 63341,
'title': 'Romblon Shopping Center',
'averageRating': 0.0,
'category': {'id': 'mall',
'title': 'Shopping Centre',
'href': 'https://places.ls.hereapi.com/places/v1/categories/places/mall',
'type': 'urn:nlp-types:category',
'system': 'places'},
'icon': 'https://download.vcdn.data.here.com/p/d/places2/icons/categories/09.icon',
'vicinity': 'Bagacay, Romblon<br/>Philippines',
'having': [],
'type': 'urn:nlp-types:place',
'href': 'https://places.ls.hereapi.com/places/v1/places/608jx7ps-e037893cbff505fbef78dc1294497c1d;context=Zmxvdy1pZD1jNDhkZGI5ZC1hY2E0LTU3MDctOTEzOS1jOTk3MmU1NWFkNDdfMTU3OTIzNDM1MjU3N18xNDM1XzQ2MzAmcmFuaz0w',
'id': '608jx7ps-e037893cbff505fbef78dc1294497c1d'}
...
I tried accessing the next link by adding my API Key on the request but I can't seem to get the next list of results.
next_results = requests.get('https://places.ls.hereapi.com/places/v1/discover/search?apiKey={API_KEY_HERE};context=Zmxvdy1pZD1jNDhkZGI5ZC1hY2E0LTU3MDctOTEzOS1jOTk3MmU1NWFkNDdfMTU3OTIzNDM1MjU3N18xNDM1XzQ2MzAmb2Zmc2V0PTIwJnNpemU9MjA?at=12.8797%2C121.774&q=mall')
https://places.ls.hereapi.com/places/v1/discover/search?apiKey={API_KEY_HERE};context=Zmxvdy1pZD1jNDhkZGI5ZC1hY2E0LTU3MDctOTEzOS1jOTk3MmU1NWFkNDdfMTU3OTIzNDM1MjU3N18xNDM1XzQ2MzAmb2Zmc2V0PTIwJnNpemU9MjA?at=12.8797,121.774&q=mall
Your next url is malformed. The apiKey should be along with the other query string parameters at and q:
https://places.ls.hereapi.com/places/v1/discover/search;context=Zmxvdy1pZD1jNDhkZGI5ZC1hY2E0LTU3MDctOTEzOS1jOTk3MmU1NWFkNDdfMTU3OTIzNDM1MjU3N18xNDM1XzQ2MzAmb2Zmc2V0PTIwJnNpemU9MjA?apiKey=API_KEY_HERE&at=12.8797,121.774&q=mall
With a properly formed next url, I get the following response for the coordinates you used and the mall search word:
{
"previous": "https://places.ls.hereapi.com/places/v1/discover/search;context=Zmxvdy1pZD01NWRiOTk5NC0zM2ZmLTUwMjctOWRmOC01MmE5YzMyZmJhM2RfMTU3OTI1OTczODg3NF84MjYxXzE3NDQmb2Zmc2V0PTAmc2l6ZT0yMA?at=12.8797%2C121.774&q=mall",
"next": "https://places.ls.hereapi.com/places/v1/discover/search;context=Zmxvdy1pZD01NWRiOTk5NC0zM2ZmLTUwMjctOWRmOC01MmE5YzMyZmJhM2RfMTU3OTI1OTczODg3NF84MjYxXzE3NDQmb2Zmc2V0PTQwJnNpemU9MjA?at=12.8797%2C121.774&q=mall",
"offset": 20,
"items": [
{
"position": [
11.962863,
121.925928
],
"distance": 103274,
"title": "Mit",
"averageRating": 0.0,
"category": {
"id": "mall",
"title": "Shopping Centre",
"href": "https://places.ls.hereapi.com/places/v1/categories/places/mall",
"type": "urn:nlp-types:category",
"system": "places"
},
"icon": "https://download.vcdn.data.here.com/p/d/places2/icons/categories/09.icon",
"vicinity": "Balabag, Malay, 5608<br/>Philippines",
"having": [],
"type": "urn:nlp-types:place",
"href": "https://places.ls.hereapi.com/places/v1/places/608wdnsn-d3edd5c804da4698bc913e04da8ca891;context=Zmxvdy1pZD01NWRiOTk5NC0zM2ZmLTUwMjctOWRmOC01MmE5YzMyZmJhM2RfMTU3OTI1OTczODg3NF84MjYxXzE3NDQmcmFuaz0yMA",
"id": "608wdnsn-d3edd5c804da4698bc913e04da8ca891"
},
...
]
}
We are seeing different behaviour when we create a workspace in the WebInterface versus when we create the same conversation via the API.
The JSON export for the dialognode is the same:
{ "type": "standard",
"title": "SmallTalk: weerbericht",
"output": {
"text": {
"values": [],
"selection_policy": "sequential" } },
"parent": "smalltalk_container",
"context": { "user_weer": "#weerbericht",
"user_location": "#plaatsnamen" },
"metadata": {
"_customization": {
"mcr": false } },
"next_step": { "behavior": "jump_to", "selector": "condition", "dialog_node": "node_33_1519129633532"
},
"conditions": "#ST_weersbericht",
"description": null,
"dialog_node": "node_9_1517408489377",
"previous_sibling": "node_3_1518680265483" },
But the behaviour is different, which can be explained when we look at the UI
there is a difference
This is the UI for the dialogNode created via the browser
This is the UI for the same dialogNode created via the API
One difference we found is the Multiple Reponse switch:
It should be OFF (image on the right) and as per the JSON (mcr:false).
But even when we switch it on manually, the context variables don't show.
What should I be looking for in the API to fix this ?
The dialog model for multiple condition responses is that the parent node needs to be either standard dialog node or frame. Now when adding a multiple condition response to this node (and hence making an MCR node out of that parent node) you need to add a dialog node with "type":"response_condition" under this node.
This is a way how to create multiple condition responses through the api.
To give you and example to create MCR node:
The JSON of dialog nodes that need to pushed through the API will look like:
{
"type": "standard",
"title": "mcr node",
"output": {
},
"parent": null,
"context": null,
"metadata": {
"_customization": {
"mcr": true
}
},
"next_step": null,
"conditions": "#book_flight",
"digress_in": "does_not_return",
"description": null,
"dialog_node": "node_8_1525086089064",
"digress_out": "allow_all",
"previous_sibling": null
},
{
"type": "response_condition",
"title": null,
"output": {
"text": {
"values": ["I see city entity!"]
}
},
"parent": "node_8_1525086089064",
"context": null,
"metadata": {
},
"next_step": null,
"conditions": "#city",
"description": null,
"dialog_node": "node_9_1525086100114",
"previous_sibling": null
},
{
"type": "response_condition",
"title": null,
"output": {
"text": {
"values": ["I don't see anything."]
}
},
"parent": "node_8_1525086089064",
"context": null,
"metadata": {
},
"next_step": null,
"conditions": "anything_else",
"description": null,
"dialog_node": "node_10_1525086122332",
"previous_sibling": "node_9_1525086100114"
}
I'm trying to query freebase to find information about a specific city.
I'm able to find the city that I'm looking for but I need to get the description content as well as a few pictures.
My current query is
[{
"name": "san francisco",
"id": null,
"type": "/location/citytown",
"/location/location/geolocation" : [
{
"latitude": null,
"longitude": null,
"latitude>" : 36,
"latitude<" : 38 }]
"/common/topic/article" : [{ "id" : null, "content": null }],
"/common/topic/image" : [{
"id" : null,
"optional" : true,
"limit" : 15
"image_caption" : []
}]
}]
Which returns
{
"code": "/api/status/ok",
"result": [{
"/common/topic/article": [{
"content": null,
"id": "/m/0d6l_"
}],
"/common/topic/image": [
{
"id": "/m/02929wx",
"image_caption": []
},
{
"id": "/m/04j74y4",
"image_caption": []
},
{
"id": "/m/04j74yh",
"image_caption": []
},
{
"id": "/m/04j74yw",
"image_caption": []
},
{
"id": "/m/04j74z6",
"image_caption": []
}
],
"/location/location/geolocation": [{
"latitude": 37.775,
"longitude": -122.4183
}],
"id": "/en/san_francisco",
"name": "San Francisco",
"type": "/location/citytown"
}],
"status": "200 OK",
"transaction_id": "cache;cache03.p01.sjc1:8101;2012-07-24T21:50:06Z;0029"
}
I can't get the content value and the captions to be set.
Am I missing something ?
Where did you find the "image_caption" property? If you switch it to "name" you should get the names of the images (which are used as captions in some UI contexts).
The text content isn't available from MQL, but you can get it from the BLOB service in the old API or the text API in the new APIs using the ID that is returned for the article. e.g. https://www.googleapis.com/freebase/v1/text/m/0d6l_
p.s. If you just want the primary image, you might consider using the Topic API which will return you the image, it's name, the text blurb, and a bunch of other info in a single call.
https://www.googleapis.com/freebase/v1/topic/wikipedia/en_id/49728
Using the Search API will give you more robust name matching as well as give you a score which will tell you how likely it is that the query is ambiguous (if you get multiple matches with scores close to each other).
https://www.googleapis.com/freebase/v1/search?query=%22san%20francisco%22&type=/location/citytown
In addition to this question:link i'm asking if i can retrieve data like the text or even geolocation from topics that seems that they have not any info been entered(but there is text description from wikipedia)
So, the problem is that when you run the following query you don't get any results:
[{
"name": "River Thames",
"type": "/location/location",
"geolocation": [{
"latitude": null,
"longitude": null
}],
"/common/topic/article": [{
"text": {
"maxlength": 16384,
"chars": null
}
}]
}]
Try it out
This is because Freebase doesn't have geocoordinates (yet) for a topic called "River Thames". In other words, there are no combination of facts in Freebase that will match this query structure exactly so it returns nothing. It does however have coordinates for the mouth of the river so you will get results for this similar query:
[{
"name": "River Thames",
"type": "/location/location",
"/geography/river/mouth_long_lat": [{
"latitude": null,
"longitude": null
}],
"/common/topic/article": [{
"text": {
"maxlength": 16384,
"chars": null
}
}]
}]
Try it out
But what should you do if you don't know beforehand whether the data that you're looking for is completely filled out in Freebase yet?
You can mark certain parts of a query as being "optional" which means that they should be returned if the data is present but that the query should still return results even if that data isn't present. So for your original query that would look like this:
[{
"name": "River Thames",
"type": "/location/location",
"geolocation": [{
"latitude": null,
"longitude": null,
"optional": true
}],
"/common/topic/article": [{
"text": {
"maxlength": 16384,
"chars": null
}
}]
}]
Try it out
Now you should get results with the text of the article present but the geolocation returned as an empty array.
One more thing I should point out is that you should be aware that the query you've written is asking for a list of ALL topics in Freebase with the name "River Thames". Right now, that query only returns one result but in the future, when more data is added to Freebase, it may return multiple results. If you're really only interested in THIS River Thames, you should query it using its unique MID like this:
{
"id": "/m/0d2kt"
"name": null,
"type": "/location/location",
"geolocation": [{
"latitude": null,
"longitude": null,
"optional": true
}],
"/common/topic/article": [{
"text": {
"maxlength": 16384,
"chars": null
}
}]
}
Try it out