Difference between start_nickname and start_address - uber-api

Can somebody explain me what is the difference between start_nickname and start_address in https://developer.uber.com/docs/riders/references/api/v1.2/requests-post ? Maybe in form of examples? I don't know which one to use to provide street and city info.

start_nickname in POST /requests is the label used for the destination in the rider app when you create a request via the api. So please use start[latitude|longitude] or start_place_id to specify Start Location.
So if you try to request a ride with just start_nickname and start_address
{
"product_id": "a1111c8c-c720-46c3-8534-2fcdd730040d",
"start_nickname" : "Uber HQ",
"start_address" : "1455 Market Street, San Francisco",
"end_latitude": 37.795,
"end_longitude": -122.440,
"end_nickname" : "Embarcadero",
"end_address" : "One Embarcadero Center, San Francisco"
}
you will get a response like:
{
"fields": {
"": "Both start_latitude and start_longitude or start_place_id are
required."
},
"message": "Invalid request",
"code": "validation_failed"
}
In order to make a valid ride request you need to add:
"start_latitude": 37.776,
"start_longitude": -122.418,
Or "start_place_id" (This is the name of an Uber saved place. Only “home” or “work” is acceptable.)

Related

Content-Language metadata field in GCS object not allowing ISO-639-2 from API

While trying to update the Content-Language metadata field of an object to ISO-639-2 field from the UI works fine, when trying to do the same from http API, it fails with an invalid argument error. The official documentation page states that ISO-639-1 codes are supported (although the link goes to 639-2).
Any ideas on how to update the Content-Language via http/json for objects in ISO-639-2 ? Or it's possible the UI treats it differently?
Response from GetObject for an object with ISO-639-2 updated via ui
{
"kind": "storage#object",
"id": "XXXXXXXXX/textfile.txt/XXXXXXX",
"selfLink": ...,
"mediaLink": ...,
"name": "textfile.txt",
"bucket": "XXXXXX",
"generation": "XXXXXX",
"metageneration": "2",
"contentType": "text/plain; charset=utf-8",
"storageClass": "STANDARD",
"size": "29",
"md5Hash": "f510qpm7Jh30uKbBcN4e0A==",
**"contentLanguage": "ach",**
"crc32c": "4fnpOw==",
"etag": "COet043XpPcCEAI=",
"temporaryHold": false,
"eventBasedHold": false,
"timeCreated": "2022-04-21T07:56:14.769Z",
"updated": "2022-04-21T07:57:14.321Z",
"timeStorageClassUpdated": "2022-04-21T07:56:14.769Z",
"metadata": {
"gcsfuse_mtime": "2022-04-21T07:56:13.375009661Z"
}
}
Error when trying to set the same value as received in the above call via json
{
"error": {
"code": 400,
"message": "Invalid argument.",
"errors": [
{
"message": "Invalid argument.",
"domain": "global",
"reason": "invalid"
}
]
}
}
I reproduced your case, and it seems like you are right. Content-Language only allows ISO 639-1 language codes for the supported values of this metadata.
When Content-Language was set to “ach” in JSON POST API call it gave me errors “curl: (3) Failed to convert ach” to ACE; string contains a disallowed character” but when set to “en”/ “de”/ “aa” it works fine and gives a HTTP 200 response. I think the logic which works here, checks for ISO 639-1 format.
I have gone through the documentation, and it says clearly “Refer to ISO 639-1 language codes for the supported values of this metadata.” Maybe it routes to ISO 639-2 page, because it contains both ISO 639-1 and ISO 639-2 codes, out of which it mentions it only supports ISO 639-1 language codes. You can check out this documentation as well.
Raise a feature request here so that the Content-Language supports ISO 639-2 language code in API calls.

Keycloak RestAPI: Assign client role to group

I have trying this:
url="https://{localhost}/auth/admin/realms/{realm_name}/groups/{group_id}/role-mappings"
payload=[{"id":"role_id","name":"Role_name","composite":"false","clientRole":"true","containerId":"client_id"}]
But, it doesnt work, i think it may be related to the wrong payload
Any ideas pls
We can use the python-keycloak lib: https://pypi.org/project/python-keycloak/
there is a function: assign_group_client_roles
The format is correct but you make sure the client has available payloaded role.
This is example for, "Hr" group added "RomoteApp" client the "tile limit" role.
In Keycloak UI, # Client > RemoteApp > Roles
Role name
time limit
Groups > hr
Client Roles: RemoteApp
Available Roles: time limit
Assigned Roles: not yet include "time limit"
POST commend by Postman - I am not yet can attache image due to low level of stan overflow
http://127.0.0.1:8080/auth/admin/realms/Test-realm/groups/9efef6bf-7edb-496e-bc0d-a8d4f5f4e3a9/role-mappings/clients/60a19179-f244-42f8-9950-04f2119a4e5b?client=RemoteApp&id=60a19179-f244-42f8-9950-04f2119a4e5b&realm=Test-realm
in body of postman with row JSON option ( Content-Type : application/json )
[
{
"id": "e17f9f7f-62dc-4998-b058-49b845ff5cef",
"name": "time limit",
"description": "time limit",
"composite": false,
"clientRole": true,
"containerId": "60a19179-f244-42f8-9950-04f2119a4e5b"
}
]
group list
{
"id": "9efef6bf-7edb-496e-bc0d-a8d4f5f4e3a9",
"name": "hr",
"path": "/hr",
"subGroups": []
}
client list
{
"id": "60a19179-f244-42f8-9950-04f2119a4e5b",
"clientId": "RemoteApp",
...
}
also don't remember the access token called by token endpoint w/ grant_type is password
http://127.0.0.1:8080/auth/realms/Test-realm/protocol/openid-connect/token

Having an issue with Dialogflow API WebhookResponse V2 for Actions for Google

I'm testing Actions for Google, so I created some simple Sinatra application which looks something like:
require 'sinatra'
require 'json'
post '/google_assistant_api' do
content_type :json
case intent_name
when "input_welcome"
decorated_response
when "Recipe name"
basic_card
end
end
private
def decorated_response
{
source: "test source",
speech: "speech",
display_text: "something"
}.to_json
end
def intent_name
parsed_request["queryResult"]["intent"]["displayName"]
end
def parsed_request
#parsed_request ||= JSON.parse(request.body.read)
end
def basic_card
{
"fulfillmentText": "ACTIONS_ON_GOOGLE",
"fulfillmentMessages": [
{
"platform": "PLATFORM_UNSPECIFIED",
"text": {
"text": [
"string text"
]
},
"image": {
"imageUri": "https://avatars3.githubusercontent.com/u/119195?
s=400&v=4"
},
"basicCard": {
"title": "title string",
"subtitle": "subtitle",
"formattedText": "formatted text",
"image": {
"imageUri": "https://avatars3.githubusercontent.com/u/119195"
},
"buttons": []
}
}
],
"source": "source string"
}.to_json
end
Please note that I'm using V2 of the API and testing using google assistant:
I tried many other response formats based on https://gist.github.com/manniru/f52af230669bd3ed2e69ffe4a76ab309 with no luck. I keep getting:
Sorry! there was no response from the Agent. Please try later.
Is there anyone who tried non nodejs response with luck? I would appreciate any sample response as the simple response seems to be working, however as for the basic card I'm having no luck.
Dialogflow's v2 API uses a different format for webhook requests and responses which is documented here:
Dialogflow v2 Webhook Request
Dialogflow v2 Webhook Response
It appears that your code is using the old format.

VALIDATION ERRORS

I get an error when I run a code with a transaction update. What should I do?
MalformedResponse
expected_inputs[0].possible_intents[0].input_value_data.transaction_decision_value_spec.proposed_order.cart.line_items[0].sub_lines[0].line_items[1].sub_lines[0].sub_lines[0]:
line item must not have more than $0 note(s).
when say "confirm transaction" I get response
{
"audioResponse": "//NExAASWo...",
"conversationToken": "CiZDIzU5Y2...",
"expectUserResponse": true,
"response": "Here's your order summary. Your total is $38.99 . Ready to place the order?",
"visualResponse": {
"agentLogoUrl": "",
"visualElements": []
}
}
Can you answer me more?
When I want to get the delivery address I request "Get address"
and i get response "Your Google Account is missing a delivery address. You can add an address, then come back and try again."
{
"audioResponse": "//NExAAQyD...",
"conversationToken": "GhZzaW11bG...",
"response": "Your Google Account is missing a delivery address. You can add an address, then come back and try again.",
"visualResponse": {
"agentLogoUrl": "",
"visualElements": []
}
}

Google Calendar API key is not working

So accessing from here: https://console.developers.google.com/project
In my project, I just enabled the Calendar API.
Now I am trying to do the following: (my key hidden for obvious reasons)
$client = new Zend_Http_Client('https://www.googleapis.com/calendar/v3/calendars/en.usa#holiday#group.v.calendar.google.com/events');
$client->setParameterGet(array(
'key' => '########################',
));
$feed = $client->request()->getBody();
echo "<pre>";
print_r($feed);
exit;
But doing that gives me the following error:
{
"error": {
"errors": [
{
"domain": "global",
"reason": "required",
"message": "Login Required",
"locationType": "header",
"location": "Authorization"
}
],
"code": 401,
"message": "Login Required"
}
}
What am I doing wrong? I am using a Server API Key.
A few days ago I had similar problem. Check your calendar ID in www.google.com/calendar/ -> my calendar -> calendar settings and calendar address. Id should contain letters and numbers, not email address.
I figured it out. The calendar ID must be urlencoded.