Superset API Request Filters - apache-superset

I'm attempting to retreive a list of dashboards via the superset API which have a specific owner. I've attempted many unsuccessful ways to compose the request:
/api/v1/dashboard/?q={
"filters": [
{
"col": "owners__username",
"opr": "eq",
"value": "bi"
}
]
}
Resulted in Filter column: owners__username not allowed to filter
/api/v1/dashboard/?q={
"filters": [
{
"col": "owners",
"opr": "any",
"value": {
"col": "username",
"opr": "eq",
"value": "bi"
}
}
]
}
Result: Not a valid rison schema
/api/v1/dashboard/?q={
"filters": [
{
"col": "owners",
"opr": "any",
"value": "ADMIN0"
}
]
}
Which gives me all results
What am I missing?

Try this:
/api/v1/dashboard/?q=(filters:!((col:owners,opr:rel_m_m,value:4)))
So that filter only accepts user id's
You can get a list of supported filters on each resource by:
/api/v1/dashboard/_info?q=(keys:!(filters))

Related

INVALID_PATCH_PATH error while using patch/updating the interval unit in PayPal plan update API

I used the details in body as
[
{
"op": "replace",
"path": "/billing_cycles/frequency/interval_unit",
"value": "MONTH"
}
]
I get the output as follows
{
"name": "INVALID_REQUEST",
"message": "Request is not well-formed, syntactically incorrect, or violates schema.",
"debug_id": "7e77554e0bd6d",
"details": [
{
"field": "/0/path",
"value": "/billing_cycles/frequency/interval_unit",
"location": "body",
"issue": "INVALID_PATCH_PATH",
"description": "The specified field cannot be patched."
}
],
"links": [
{
"href": "https://developer.paypal.com/docs/api/v1/billing/subscriptions#INVALID_REQUEST",
"rel": "information_link",
"method": "GET"
}
]
}
what is the correct body data to pass to update the interval_unit of the PayPal plan data.
"issue": "INVALID_PATCH_PATH",
"description": "The specified field cannot be patched."
The error message is correct, that field cannot be patched.
See the update API call's documentation for fields that can patched.
If you need a plan with different billing cycles, create a new plan.

List users as non admin with custom fields

As per the documentation, I should be able to get a list of users with a custom schema as long as the field in the schema has a value of ALL_DOMAIN_USERS in the readAccessType property. That is the exact set up I have in the admin console; Moreover, when I perform a get request to the schema get endpoint for the schema in question, I get confirmation that the schema fields are set to ALL_DOMAIN_USERS in the readAccessType property.
The problem is when I perform a users list request, I don't get the custom schema in the response. The request is the following:
GET /admin/directory/v1/users?customer=my_customer&projection=full&query=franc&viewType=domain_public
HTTP/1.1
Host: www.googleapis.com
Content-length: 0
Authorization: Bearer fakeTokena0AfH6SMD6jF2DwJbgiDZ
The response I get back is the following:
{
"nextPageToken": "tokenData",
"kind": "admin#directory#users",
"etag": "etagData",
"users": [
{
"externalIds": [
{
"type": "organization",
"value": "value"
}
],
"organizations": [
{
"department": "department",
"customType": "",
"name": "Name",
"title": "Title"
}
],
"kind": "admin#directory#user",
"name": {
"fullName": "Full Name",
"givenName": "Full",
"familyName": "Name"
},
"phones": [
{
"type": "work",
"value": "(999)999-9999"
}
],
"thumbnailPhotoUrl": "https://photolinkurl",
"primaryEmail": "user#domain.com",
"relations": [
{
"type": "manager",
"value": "user#domain.com"
}
],
"emails": [
{
"primary": true,
"address": "user#domain.com"
}
],
"etag": "etagData",
"thumbnailPhotoEtag": "photoEtagData",
"id": "xxxxxxxxxxxxxxxxxx",
"addresses": [
{
"locality": "Locality",
"region": "XX",
"formatted": "999 Some St Some State 99999",
"primary": true,
"streetAddress": "999 Some St",
"postalCode": "99999",
"type": "work"
}
]
}
]
}
However, if I perform the same request with a super admin user, I get an extra property in the response:
"customSchemas": {
"Dir": {
"fieldOne": false,
"fieldTwo": "value",
"fieldThree": value
}
}
My understanding is that I should get the custom schema with a non admin user as long as the custom schema fields are set to be visible by all domain users. This is not happening. I opened a support ticket with G Suite but the guy that provided "support", send me in this direction. I believe this is a bug or maybe I overlooked something.
I contacted G Suite support and in fact, this issue is a domain specific problem.
It took several weeks for the issue to be addressed by the support engineers at Google but it was finally resolved. The behaviour is the intended one now.

Creating an eBay fulfilment policy. ("Please select a valid postage service.")

After a day of work with Postman, I have managed to reduce the number of errors down to 1. No idea how to get past it.
Definitely not an authorisation problem. I've been making lots of authorised calls.
URI:
POST https://api.ebay.com/sell/account/v1/fulfillment_policy
Body:
{
"categoryTypes": [
{
"name": "ALL_EXCLUDING_MOTORS_VEHICLES"
}
],
"freightShipping": "false",
"globalShipping": "false",
"handlingTime": {
"unit": "DAY",
"value": "1"
},
"localPickup": "true",
"marketplaceId": "EBAY_AU",
"name": "100 grams",
"shippingOptions": [
{
"costType": "CALCULATED",
"optionType": "DOMESTIC",
"shippingServices": [
{
"shippingCarrierCode": "Australia Post",
"shippingServiceCode": "AU_Regular"
}
]
}
]
}
Output:
{
"errors": [
{
"errorId": 20403,
"domain": "API_ACCOUNT",
"category": "REQUEST",
"message": "Invalid .",
"longMessage": "Please select a valid postage service.",
"inputRefIds": [
"service"
],
"parameters": [
{
"name": "XPATH",
"value": "DomesticItemShippingService[0].shippingService"
}
]
}
]
}
Things I've Tried:
Deleting "shippingOptions": [...] (and everything inside the []s) got rid of the errors and resulted in the successful creation of a new fulfillment policy. However, I wanted to include shipping options in my call.
shippingCarrierCode doesn't seem to do anything. I've changed it to all sorts of sensible and non sensible things, including deleting it entirely. No impact on the output.
Changing shippingServiceCode to anything non-standard (eg "shippingServiceCode": "potato") results in getting the exact same error, but twice instead of once. (See below) How can I get the same error twice with only one shipping option?
Including a domestic and international option, I get the same error twice also. (Same output as below, except the second DomesticItemShippingService[1].shippingService is instead DomesticItemShippingService[0].shippingService)
Making an international option AND a domestic option, BOTH with silly service names results in 3 errors. (I was expecting 4.)
Code:
{
"errors": [
{
"errorId": 20403,
"domain": "API_ACCOUNT",
"category": "REQUEST",
"message": "Invalid .",
"longMessage": "Please select a valid postage service.",
"inputRefIds": [
"service"
],
"parameters": [
{
"name": "XPATH",
"value": "DomesticItemShippingService[0].shippingService"
}
]
},
{
"errorId": 20403,
"domain": "API_ACCOUNT",
"category": "REQUEST",
"message": "Invalid .",
"longMessage": "Please select a valid postage service.",
"inputRefIds": [
"service"
],
"parameters": [
{
"name": "XPATH",
"value": "DomesticItemShippingService[1].shippingService"
}
]
}
]
}
What did I do wrong this time?
I did get an answer to my question. Not here, even though I sent them the link here, but I got the answer (eventually) through official eBay channels.
I'll post that answer here for everyone. I was thinking of adding correct stackoverflow formatting, but decided it would be better to leave the correct answer untouched from the original.
Hello Jonathon ,
Ignore my last message and Apologize for the confusion.
Here is the reason why you are getting the error:
You have to set "localPickup": "false", refer doc for your help:
https://developer.ebay.com/api-docs/sell/account/resources/fulfillment_policy/methods/createFulfillmentPolicy#request.localPickup
And you will get response as:
{ "name": "100 grams", "marketplaceId": "EBAY_AU",
"categoryTypes": [
{
"name": "ALL_EXCLUDING_MOTORS_VEHICLES",
"default": true
} ], "handlingTime": {
"value": 1,
"unit": "DAY" }, "shippingOptions": [
{
"optionType": "DOMESTIC",
"costType": "CALCULATED",
"shippingServices": [
{
"sortOrder": 1,
"shippingCarrierCode": "Australia Post",
"shippingServiceCode": "AU_Regular",
"freeShipping": false,
"buyerResponsibleForShipping": false,
"buyerResponsibleForPickup": false
}
],
"insuranceOffered": false,
"insuranceFee": {
"value": "0.0",
"currency": "AUD"
}
} ], "globalShipping": false, "pickupDropOff": false, "freightShipping": false, "fulfillmentPolicyId": "6104871000",
"warnings": [] }
Let us know if you need further assistance!!!
Best Regards, eBay Developer Support
Check them out here. Make sure you have all the required fields.
pickupDropOff
shippingOptions.shippingServices.shipToLocations.regionIncluded

Drupal-8 restful webservices only delivering HTML

I have a freshly configured Drupal 8.0 beta 12 with HAL, HTTP Basic Authentication, RESTful Web Services and Serialization modules enabled. The installation is in a subfolder (D8_beta12). When I access the web services for the first page created (id=1) like
curl -H "Accept: application/json" --request GET http://localhost/d8_beta12/node/1
DRUPAL only delivers HTML format of the node. I have tried to configure via REST UI to JSON only but that didn't help. DRUPAL would answer the requests even if the web services are disabled.
Its probably the user, who's sitting in front of DRUPAL, who is the problem (me) - but I don't get it. Any help deply appreciated - I have been working hours on this, reviewing all of DRUPALs forums and here as well.
Thanks,
Andi
I was getting the same and found a note about it https://drupal.stackexchange.com/questions/161421/d8-services-errors-no-route-found-for-the-specified-formats
So I updated the request to :
node/1?_format=json
Update: Found note about it in a webchick slideshare:
http://www.slideshare.net/webchickenator/plain-english-guide-to-drupal-8-criticals/51
Please try replacing aaplication/json with application/hal+json.
curl -H "Accept: application/hal+json" --request GET http://localhost/d8_beta12/node/1
You may also like to go through this precise tutorial.
from postman if you are trying or from other rest api you are trying make sure you follow below format
http://localhost/da/drupal819/node/253?_format=json
output
{
"nid": [
{
"value": "253"
}
],
"uuid": [
{
"value": "6f255c93-6886-4c38-b4cb-c40469073d1c"
}
],
"vid": [
{
"value": "253"
}
],
"langcode": [
{
"value": "en"
}
],
"type": [
{
"target_id": "article",
"target_type": "node_type",
"target_uuid": "ee2c7b5e-d57e-4714-9193-daff153c63ff"
}
],
"title": [
{
"value": "Commodo Pagus Quia"
}
],
"uid": [
{
"target_id": "14",
"target_type": "user",
"target_uuid": "0b8602ec-8003-4e3d-8406-5bd53e47df71",
"url": "/da/drupal819/user/14"
}
],
"status": [
{
"value": "1"
}
],
"created": [
{
"value": "1474126412"
}
],
"changed": [
{
"value": "1474175616"
}
],
"promote": [
{
"value": "1"
}
],
"sticky": [
{
"value": "0"
}
],
"revision_timestamp": [
{
"value": "1474175616"
}
],
"revision_uid": [
{
"target_id": "14",
"target_type": "user",
"target_uuid": "0b8602ec-8003-4e3d-8406-5bd53e47df71",
"url": "/da/drupal819/user/14"
}
],
"revision_log": [],
"revision_translation_affected": [
{
"value": "1"
}
],
"default_langcode": [
{
"value": "1"
}
],
"path": [],
"body": [
{
"value": "Duis revitas melior paulatim quibus quidne rusticus velit vereor.\n\n",
"format": "plain_text",
"summary": "Duis vitas melior paulatim quibus quidne rusticus velit vereor.\n\n"
}
],
"comment": [
{
"status": "2",
"cid": "165",
"last_comment_timestamp": "1474175616",
"last_comment_name": "",
"last_comment_uid": "13",
"comment_count": "1"
}
],
"field_image": [
{
"target_id": "248",
"alt": "Diam iriure neo quadrum refero valetudo verto ymo.",
"title": "Os patria refoveo si valetudo.",
"width": "225",
"height": "526",
"target_type": "file",
"target_uuid": "02050136-7a51-4183-9c28-7d7cc793183a",
"url": "http://localhost/da/drupal819/sites/default/files/2016-09/gen8C.tmp.jpeg"
}
],
"field_tags": []
}
you can try other format as well
1) http://localhost/da/drupal819/node/253?_format=hal_json
2) http://localhost/da/drupal819/node/253?_format=xml
to support all above format you need to make that format support from rest configuration from admin panel
and even you need to provide get permission for rest call from permission page for anonymous user.

Ember data and mongodb state?

According to http://emberjs.com/api/data/classes/DS.EmbeddedRecordsMixin.html
Records without an id property are not considered embedded records, model instances must have an id property to be used with Ember Data.
If thats so how would i use a model like:
{
"_id": "545b54f20dbd7015f015359a",
"comments": [
{
"msg": "what is this jelly",
"time": "1415271666",
"user": {
"id": "53fefc9ee4b07d3fe92fc077",
"username": "kfir124"
}
}
],
"files": [
{
"key": "1415271653.39af9c9fb8cc8b49dcaac5eec72614ce85.jpg",
"order": 0
}
],
"time": "1415271666",
"uploader": {
"id": "53fefc9ee4b07d3fe92fc077",
"username": "kfir124"
}
}
So uploader may be an embedded record but what about files and comments? they are both arrays of objects which do not live outside of the main model's namespace therefore they have no IDs