I am using simple_salesforce and get all records of a custom object called "SER__Condition__c". I know for a fact that that is the name because I got a list of table names from our administrator.
"api" is an instance of "simple_salesforce.Salesforce".
This is the command I'm executing:
pprint(api.query('SELECT Id FROM SER__Condition__c'))
Which returns this error:
File "path\to\lib\simple_salesforce\api.py", line 698, in _exception_handler
raise exc_cls(result.url, result.status_code, name, response_content)
simple_salesforce.api.SalesforceMalformedRequest: Malformed request https://xxx.salesforce.com/services/data/v29.0/query/?q=SELECT+Id+FROM+SER__Condition__c. Response content: [{'message': "\nSELECT Id FROM SER__Condition__c\n
^\nERROR at Row:1:Column:16\nsObject type 'SER__Condition__c' is not supported. If you are attempting to use a custom object, be sure to append the '__c' after the entity name. Please reference your WSDL or the describe call for the appropriate names.", 'errorCode': 'INVALID_TYPE'}]
Using the exact same command for a default object returns all the records as expected:
pprint(api.query('SELECT Id FROM Account'))
The same also holds true for these two:
api.Account.get('xxxxxxxxxxxxxxxxxx')
api.SER__Condition__c.get('xxxxxxxxxxxxxxxx')
It probably is a permissions issue. Make sure the SER__Condition__c object is visible to the user you are running the query as.
I am 90% sure the issue is with the name of the object. Per Salesforce, the naming convention for a custom object cannot include two consecutive underscores. From the Salesforce error message on object creation: "Error: The Object Name field can only contain underscores and alphanumeric characters. It must be unique, begin with a letter, not include spaces, not end with an underscore, and not contain two consecutive underscores."
If you change "SER__Condition__c" to "SER_Condition__c" (a single underscore between "SER" and "Contition") it should fix the issue.
Yes, I resolved this issue by editing the user profile's custom object permissions. It looks like it defaults to none.
Related
I am trying to use rasgo.get.dataset(fqtn='vw_orders_main') but I am getting an error.
APIError: Dataset with fqtn 'vw_orders_main' does not exist or this API key does not have access.
When using rasgo.get.dataset(), you can either:
pass in a dataset_id
rasgo.get.dataset(123)
pass in a fully qualified table name (fqtn)
rasgo.get.dataset(fqtn="DB.SCHEMA.TABLE")
pass in a resource_key
rasgo.get.dataset(resource_key='mykey')
From the appearance of the string you are using, I believe that is a resource key.
If you are using a variable called vw_orders_main to hold the FQTN string, then try it without the single quotes.
Examples:
vw_orders_main = "DB.SCHEMA.TABLE"
rasgo.get.dataset(fqtn=vw_orders_main)
or
rasgo.get.dataset(fqtn="DB.SCHEMA.TABLE")
or, if what you meant was resource_key,
rasgo.get.dataset(resource_key='vw_orders_main')
A resource_key is randomly assigned when a dataset is published, unless you specify the string yourself (like it appears that you did). It provides you the ability to tie multiple datasets as 1, thus allowing “versions”.
Resource Links: get dataset, publish dataset
When using the jira python library and creating issues, non mandatory fields are being enforced on create_issue call.
Response on create issue attempt:
text: No issue link type with name 'Automated' found.
Response on create meta call to check mandatory fields:
'hasDefaultValue': False,
u'key': u'issuelinks',
u'name': u'Linked Issues',
u'operations': [u'add'],
u'required': False,
I had a similar issue and after a bit of digging around, this is what I did.
Open a jira and using developer tools (F12), find out the id of the mandatory custom fields. They should be named somewhat like "customfield_10304"
Once you have these field ids, just use them the way you set other fields while creating an issue. For eg.
new_issue = jira.create_issue(project={'key': project},
summary='{}'.format(summary),
description='{}'.format(description),
issuetype={'name': 'Bug'},
labels=labels,
versions=[{"name": affect_version[0]}],
customfield_10304=[{"value": env}],
customfield_10306=[{"value": customer}],
priority={'name': priority})
Jira behaves strange many times.
createmeta call returns you all the possible issuetypes, and their all fields, and which field is mandatory or not.
But even after this, there are certain fields which are mandatory but createmeta wont tell you this. You need to rely on the exception message that you got after filing create_issue().
In the exception message, exception_obj.response.text gives you the json having key/value of exact field required.
Then, you can search in response of createmeta about its schema type, and may be the allowedValues set.
And, then try again.
Basically, you need to do retry of above mechanism.
I've been playing around the the Reddit API and I've come across this endpoint:
GET /api/user_data_by_account_ids
According the the documentation, the query parameter for this endpoint is a comma separated list of fullnames. Reddit defines a fullname as:
"a combination of a thing's type (e.g. Link) and its unique ID which forms a compact encoding of a globally unique ID on reddit. Fullnames start with the type prefix for the object's type, followed by the thing's unique ID in base 36. For example, t3_15bfi0."
So I'm wondering how I can determine a user's fullname? Is it listed somewhere in their profile? Or is there another endpoint in Reddit's api for getting a user's fullname?
When you send a query to /user/username/about, the base-36 ID is included as the value of id in the data property of the response. Concatenate this to the value of the kind property in the result (this should be 't2' for any user) with an underscore in between, and you'll have their fullname.
I am using Spyne to create a WebService from an existing WSDL (we can not change any element names, etc.).
I am facing this issue that one element name has a hyphen.
The code fragment is below:
class RequestType(ComplexModel):
_type_info = [
('Book_Name', Unicode(min_occurs=1)),
('orderedCount-totalCount', Unicode(min_occurs=1)),
......
The code
print(RequestType.orderedCount-totalCount)
raises this error:
AttributeError: 'RequestType' object has no attribute 'orderedCount'
It seems Python does not understand the hyphen character.
I can not change the element name because of strict name rules, which are required by the existing WebClient.
Is there any way to access the value from this element in Spyne/Python?
Can we read values based on their order instead of their names?
You can use getattr(inst, 'orderedCount-totalCount')
I'm trying to validate json using python validictory, but when I get a validation error the validation ends and missing field name is reported, but if there is more than one field missing I only get a message about the first one. I need to know about all the fields that are missing. Is there an function which will return all missing fields?
This script only needs to validate a json document, so answers using other libraries, languages are welcome.
When you call .validate() set fail_fast property to False. That will force validictory to return all errors instead of only first one.