Different returns for equal requests - uber-api

When I try to request a trip for certain users the API returns me that the product_id is invalid.
For other users in the same location and product_id returns the fare data.
I'm looking for the product_id in /products endpoint.
Sample request:
URL: https://api.uber.com/v1.2/requests/estimate (POST)
{
"start_latitude": -30.030571,
"start_longitude": -51.194116,
"end_latitude": -30.034647,
"end_longitude": -51.217658,
"product_id": "PRODUCT_ID"
}
Can help me understand what might happen?

Related

Query Firestore Rest API by multiple document ids

I have noticed that documents that are returned by the API / runQuery do contain the document name, but I can't find any information within the structuredQuery docs how to query by multiple ids.
{
document: {
name: 'projects/:projectId/databases/(default)/documents/collection/id',
fields: ...,
createTime: '2021-01-16T13:35:02.151442Z',
updateTime: '2021-01-18T10:42:32.257199Z'
},
readTime: '2021-01-18T17:10:33.600112Z'
},
Firestore does support a whereIn query by document id Collection.where(firestore.FieldPath.documentId(), 'in', ["123","456","789"]), so I thought the Rest API might support is as well.
Do I miss something, or does runQuery not support queryById functionality?
This can be done by calling batchGet endpoint:
https://content-firestore.googleapis.com/v1beta1/projects/<PROJECT_ID>/databases/(default)/documents:batchGet
with the following JSON on the request body.
{
"documents": [
"projects/<PROJECT_ID>/databases/(default)/documents/<COLLECTION_ID>/<DOC_ID1>",
"projects/<PROJECT_ID>/databases/(default)/documents/<COLLECTION_ID>/<DOC_ID2>",
"projects/<PROJECT_ID>/databases/(default)/documents/<COLLECTION_ID>/<DOC_ID3>",
]
}

Agora cloud recording not starting

I am following Agora Cloud Recording RESTful apis
The problem is
Acquire api working fine
Start api working fine
Now query api is returning me
{
"resourceId": "rid",
"sid": "sid",
"serverResponse": {
"status": 4,
"fileList": "",
"fileListMode": "string",
"sliceStartTime": 0
}
}
and stop api giving me
{
"resourceId": "rid",
"sid": "sid",
"code": 435
}
which means no one is present in channel.
But 2 users are there in my ongoing channel
My start request was
{
"cname":"80f350442cb2a26ccacb5cfb058c6e82",
"uid":"936239554", // userid who i want to record...is this correct????
"clientRequest":{
"token": "temp_token_generated_from_agora_console",
"recordingConfig":{
"channelType":0,
"streamTypes":2,
"audioProfile":1,
"videoStreamType":0,
"maxIdleTime":120,
"transcodingConfig":{
"width":360,
"height":640,
"fps":30,
"bitrate":600,
"maxResolutionUid":"1",
"mixedVideoLayout":1
}
},
"subscribeVideoUids": ["936239554"], // is this correct??
"subscribeAudioUids": ["936239554"], //is this correct??
"storageConfig":{
"vendor":1,
"region":14,
"bucket":"my_bucket_name",
"accessKey":"xxxx",
"secretKey":"xxxx"
}
}
}
When using Agora's Cloud Recording service, the Recorder instance needs to have its own unique ID that it uses to join the channel and record the other users that are defined in the "subscribeVideoUids": portion of the request.
In the code snippet below first UID is meant to be unique for the Recorder to use to join the channel.This is not meant to be the UID for the user you wish to record.
"cname":"80f350442cb2a26ccacb5cfb058c6e82", "uid":"936239554", // userid who i want to record...is this correct????
if the user's UID is , "936239554" then the recorder should have a different/unique value even just adding an integer to the end "9362395541" is enough.
Im the "subscribeVideoUids" and "subscribeAudioUids" you'll want to include all the UID's of the users in the channel that you want to record. So if there are two users in the channel, include each UID as an element of the Array.
"subscribeVideoUids": ["936239554"],"subscribeAudioUids": ["936239554"],

Passing discount code in Orders API on Shopify

I have been trying to develop an app that takes an order on Shopify on a different channel. I successfully placed an order through the API but I am not able to include the discount code along with the order. The JSON object for the POST data is as below:
{
order: {
email : request.params.order.email, // string
financial_status : 'pending', // string
send_receipt : true, // boolean
send_fulfillment_receipt : false, // boolean
note : request.params.order.note, // string
discount_codes : [], // supposed to be an array of Object| Problem here,
line_items : request.params.order.line_items, // array
customer : request.params.customer, // JSON object
billing_address : request.params.order.billing_address, // JSON object
shipping_address : request.params.order.shipping_address // JSON object
}
}
According to the documentation, the discount_codes is like this -
Applicable discount codes that can be applied to the order. If no codes exist the value will default to blank. A Discount code will include the following fields:
amount: The amount of the discount.
code: The discount code.
type: The type of discount. Can be one of : "percentage", "shipping", "fixed_amount" (default).
What am I doing wrong? My discount_codes is this
[{amount: 100,code:'WELCOME10',type:'percentage'}]
Has anyone done this before?
According to this response from Shopify what you are trying to do is only possible if you pass the total_discounts field along as well with the total amount of the discount you want to apply.
As you will see in this other answer, any codes you have created through Shopify are not available to use with the API and their usage will not be recorded.
I was trying to use this API in order to test the application of different coupon codes that I was generating, but this does not seem to be possible. Apparently, the API was intended for applying discounts that are custom, not ones that already exist in Shopify. This is a frustrating limitation to me.
I successfully create orders with discounts all the time, without ShopifyPlus as that is irrelevant. The data structure that works for me looks like this:
[ { "code": "Shop By PizzleFuzzle 10%", amount: "10", "type": "percentage" } ]
The discount object is available only for Shopify Plus merchants.
Once you are a Shopify Plus merchant, you will be able to create discount codes like that:
POST /admin/discounts.json
{
"discount": {
"discount_type": "percentage",
"value": "15.0",
"code": "balderdash"
}
}
Please see more detailed documentation in the discount object at Shopify API: https://help.shopify.com/api/reference/discount
You should use the value property name instead of amount property name.
e.g.
{value: 100,code:'WELCOME10',type:'percentage'}
and not
{amount: 100,code:'WELCOME10',type:'percentage'}

How do I know if a Facebook Status/Photo/Link is Private?

When I'm getting a status/link/photo from facebook API, how do I know if it has been shared with the public or if it's a private post?
Also - is there a way to query only public posts?
I'm currently using the /<username>/status /<username>/links /<username>/photos endpoints.
With the graph api
From the 3 endpoints you are using, only one gives you access to the privacy settings the /<username>/links. It returns a privacy object, something like this:
{
"id": "USER_FB_ID",
"links": {
"data": [
{
"id": "ID_OF_THE_POST",
"from": {
"name": "Fábio Antunes",
"id": "USER_FB_ID"
},
"message": "Check this awesome link",
"privacy": {
"description": "Friends; Except: Restricted",
"value": "ALL_FRIENDS",
"allow": "",
"deny": "",
"networks": "",
"friends": ""
},
(etc....)
With FQL
To solve your problem you could use FQL this way you can get the 3 endpoints that have public access.
For the links you can use this query:
Select link_id,owner_comment, title, url, privacy FROM link WHERE owner = me() AND privacy.value='EVERYONE'
note: check the link table to see if there are any fields that you may want to add to this query
Since the links table from the 3 endpoints is the only with privacy settings structure to get the user photos and statuses that are public you will have to use the privacy table.
To get all the users public photos I made 2 joins, first I'm getting the user photos, then I want the privacy settings of the photos that are available to everyone and then I select the photos that have the privacy settings public:
SELECT caption,src_big FROM photo WHERE object_id IN (SELECT id FROM privacy WHERE value='EVERYONE' AND object_id IN (SELECT object_id FROM photo WHERE owner=me()))
note: check the photo table to see if there are any fields that you may want to add to this query
To get the public statuses it's the same process for the photos, two joins:
SELECT status_id , message, place_id FROM status WHERE status_id IN (SELECT id FROM privacy WHERE value='EVERYONE' AND object_id IN (SELECT status_id FROM status WHERE uid=me()))
note: check the status table to see if there are any fields that you may want to add to this query

FaceBook API for friends count

There is the question about fetching count of user friends via FaceBook API.
I want to get the number of friends only have USER_ID of the any facebook user. As I know I can get it using FQL like:
SELECT friend_count FROM user WHERE uid = X
But for some users this value is null or there is no value. Please advice is there another way to get this value?
That user might be keeping that information private. In that case, you cannot fetch that information.
You just check the following link. You need to generate token (by clicking on Get Token you will get it) with data you want from facebook API, need to select friends option to get the friend count.
https://developers.facebook.com/tools/explorer/?method=GET&path=me%3Ffields%3Did%2Cname%2Cfriends&version=v2.8
FB.api(
'/me',
'GET',
{"fields":"id,name,friends,link,email,gender,picture,first_name,last_name,cover"},
function(response) {
// Insert your code here
}
);
after executing this you will get this in response as
{
"id": "XXXXXXXXXX",
"name": "Test test",
"friends": {
"data": [
],
"summary": {
"total_count": 14
}
}
}
total_count will be your friend count