NG and QB interchangeable in V3? - intuit-partner-platform

From a question I asked earlier (Difference between "NG" and "QB" domain IDs), I was under the impression that the NG and QB ids are interchangeable for records created in the cloud. Does this remain true for the new V3 API?
When I try to send an Invoice create request that contains a cloud-created line item's QB id, I'm getting this error:
<IntuitResponse time="2013-10-31T15:11:30.185Z" xmlns="http://schema.intuit.com/finance/v3">
<Fault type="Validation">
<Error code="0">
<Message>Operation failed with errors: Invalid field value ItemRef: Invalid ItemAll ID: [QB:5]</Message>
</Error>
</Fault>
</IntuitResponse>

Yes, an object created in V3 in cloud has an NG id and this does not changes even after sync. In the same way, an object created in QB desktop company file has a QB id and does not change even after writeback.
You cannot interchange and use them in V3

Related

Error regarding query work item gate in azure pipeline

thanks in advance.
I am facing an issue while adding gate (query work item) to control the azure pipeline flow.
Error message i am getting from logs :)
==============================================================================
Task : Query Work Items
Description : Execute a work item query and check the number of items returned
Version : 0.0.16
Author : Microsoft Corporation
Help URL : https://learn.microsoft.com/azure/devops/pipelines/tasks/utility/work-item-query
==============================================================================
Response Code: 0
Response: An error was encountered while processing request. Exception: {"$id":"*","innerException":null,"message":"TF*****: The query 1****-****-****-****-******* does not exist, or you do not have permission to read it.","typeName":"Microsoft.TeamFoundation.WorkItemTracking.Server.QueryItems.QueryItemNotFoundException, Microsoft.TeamFoundation.WorkItemTracking.Server","typeKey":"QueryItemNotFoundException","errorCode":****,"eventId":****}
Exception Message: The remote server returned an error: (404) Not Found. (type WebException)
Evaluation of expression 'xor(and(or(eq(root['queryType'], 'oneHop'), eq(root['queryType'], 'tree')), and(le(count(root['workItemRelations']), 5), ge(count(root['workItemRelations']), 0))), and(eq(root['queryType'], 'flat'), and(le(count(root['workItems']), 5), ge(count(root['workItems']), 0))))' failed.
Exception Message: Error parsing API response into a JSON object. (type DistributedTaskException)
What I have tried already :)
I have added user to all the groups like , build administrator, contributer , project administrators.
Already tried updating query permission, but no luck.
I am unable to find the issue.
The issue is the account {project name} Build Service ({Org name}) does not have enough permission to access the query.
Steps:
Open Queries->select ... on your query and add that account {project name} Build Service ({Org name}) with READ access.
Note: We should provide the permission for the account {project name} Build Service ({Org name}) to read under Shared Queries page and select query permission page.
Result:
When granting permission, search for the project name, as it does not appear in the initial list, only after performing the search. The project will only appear in the list after you perform the search.
enter image description here

wso2 API Endpoint creation failed: 404 ressource not found

I am trying to create a REST API with wso2 API_Manager to gather data from a Postgres database (learning purpose). I struggle doing so and I would like to know whether:
I did not understand wso2 components' roles properly (new techno and subject for me)
or there is an error in the way I configured the manager.
System setup
I used this official docker image, added postgres jdbc jar in /repository/components/lib/ and added the following in /repository/conf/datasources/master-datasources.xml:
<datasource>
<name>s0m3dAtabas3</name>
<description>The db used for testing purposes</description>
<definition type="RDBMS">
<configuration>
<url>jdbc:postgresql://sandor_postgres:5432/s0m3dAtabas3</url>
<driverClassName>org.postgresql.Driver</driverClassName>
<username>s0m3us3rfr0mdAtAMaj0r</username>
<password>N0t5uchAs1mple1</password>
<maxActive>80</maxActive>
<minIdle>5</minIdle>
<maxWait>60000</maxWait>
<defaultAutoCommit>false</defaultAutoCommit>
<testOnBorrow>true</testOnBorrow>
<validationInterval>30000</validationInterval>
</configuration>
</definition>
</datasource>
I made sure than the postgres' container named sandor_postgres is accessible from wso2's with these credentials. In this database, I have a table called something. The image comes with the following UIs:
admin
publisher
store
Graphical API creation
I first followed the WorldBank tutorial which seemed crystal clear (though I am not quite sure where the data came from). I then tried to adapt it.
Step 1: Design
I used the database name as context (s0m3dAtabas3) v.1.0.0. Since the table is called something, the url pattern I end up with is /s0m3dAtabas3/1.0.0/something
Step 2: Implement
This is where things start to be confusing. No matter the resource path I use in the Endpoint (end point type REST), I get a 404 and the logs are not very helpful
http://192.168.8.111:8280 -> 404
http://192.168.8.111:8280/something -> 404
http://192.168.8.111:9443/tried_several -> Invalid - Error connecting to backend
http://192.168.8.111:8243/tried_several -> Invalid - Error connecting to backend
INFO - InboundDBSyncRequestEvent Running DB sync task.
INFO - LogMediator STATUS = Message dispatched to the main sequence. Invalid URL., RESOURCE = /s0m3dAtabas3/1.0.0
INFO - CarbonAuthenticationUtil 'admin#carbon.super [-1234]' logged in at [2019-10-29 11:42:31,030+0000]
INFO - CarbonAuthenticationUtil 'admin#carbon.super [-1234]' logged in at [2019-10-29 11:42:31,197+0000]
INFO - LogMediator STATUS = Message dispatched to the main sequence. Invalid URL., RESOURCE = /s0m3dAtabas3/bullshit
INFO - CarbonAuthenticationUtil 'admin#carbon.super [-1234]' logged in at [2019-10-29 11:48:30,649+0000]
INFO - CarbonAuthenticationUtil 'admin#carbon.super [-1234]' logged in at [2019-10-29 11:48:30,790+0000]
INFO - LogMediator STATUS = Message dispatched to the main sequence. Invalid URL., RESOURCE = /
INFO - InboundDBSyncRequestEvent Running DB sync task.
INFO - LogMediator STATUS = Message dispatched to the main sequence. Invalid URL., RESOURCE = /
Did I miss some important configuration step or wso2 API Manager is not the standalone component I thought it was and requires another component to achieve what I am looking for?
It seems there is a misunderstanding in the concept-wise.
Here is the basic idea of a typical API Management solution.
You have a web service (REST, SOAP, etc...) which you need to expose as a managed API. Now, you can front your service with API Manager and expose it as a managed API with security, rate limiting, managed life cycle etc.
In your case, it seems you don't have such a service, but only have a database table. So, before using API Manager to front your service, you first need to expose your table as a service. For that purpose, I'd suggest you use the data service component of WSO2 EI 7.0.0. See [1] for how to do that. Once you have your service ready, you can use API Manager to expose it as a managed API.
[1] https://ei.docs.wso2.com/en/latest/micro-integrator/use-cases/tutorials/sending-a-simple-message-to-a-datasource/

Unable to authenticate using google cloud service account key created by python API

The sample below demonstrates failure to authenticate to google service account using the key created just the few lines above using python api.
I was not able to find any document on how these, programmatic keys, can be used.
The keys created by clicking thru console UI are working just fine.
However, for our use case, we need to create the keys using programmatic ways.
There is unanswered issue at github as well: https://github.com/googleapis/google-cloud-python/issues/7824
logger.info("Created new service account: {}".format(ret))
logger.info("Getting the new service account key")
request=iam.projects().serviceAccounts().keys().create(name=ret['name'],
body={'privateKeyType':'TYPE_GOOGLE_CREDENTIALS_FILE'})
key=request.execute()
>>>print json.dumps(key, indent=4) #just to verify what we got
{
"keyOrigin": "GOOGLE_PROVIDED",
"name": "goodandvalidname",
"validBeforeTime": "2029-06-28T15:09:59Z",
"privateKeyData": "datadata",
"privateKeyType": "TYPE_GOOGLE_CREDENTIALS_FILE",
"keyAlgorithm": "KEY_ALG_RSA_2048",
"validAfterTime": "2019-07-01T15:09:59Z"
}
>>> credentials = google.oauth2.service_account.Credentials.from_service_account_info(key)
Traceback (most recent call last):
File "/home/user/.p2/pool/plugins/org.python.pydev.core_7.2.1.201904261721/pysrc/_pydevd_bundle/pydevd_exec.py", line 3, in Exec
exec exp in global_vars, local_vars
File "<console>", line 1, in <module>
File "/home/user/.local/lib/python2.7/site-packages/google/oauth2/service_account.py", line 193, in from_service_account_info
info, require=['client_email', 'token_uri'])
File "/home/user/.local/lib/python2.7/site-packages/google/auth/_service_account_info.py", line 51, in from_dict
'fields {}.'.format(', '.join(missing)))
ValueError: Service account info was not in the expected format, missing fields token_uri, client_email.
Any help appreciated.
Answering my own issue and probably helping others...
The 'key' we get from python APIs is NOT the 'json key' as obtained from gcloud. The dict we get from iam.projects().serviceAccounts().keys().create() contains the field privateKeyData which itself contains ENTIRE 'json key' one needs to authenticate to google cloud.
The data in this field is base64 encoded and needs decoding, and subsequently dumping to json. Below is the snippet from functional code, demonstrating the credentials are loaded back from such key:
request=iam.projects().serviceAccounts().keys().create(name=ret['name'],
body={'privateKeyType':'TYPE_GOOGLE_CREDENTIALS_FILE'})
key=request.execute()
key=base64.decodestring(key['privateKeyData'])
key=json.loads(key)
credentials = google.oauth2.service_account.Credentials.from_service_account_info(key)
I figured this out by stepping thru gcloud service account key creating, line by line, using python debugger. Hope this helps others.

SharePoint Designer 2013 -> REST Service Connection -> SoapException

Hy
In SharePoint Designer 2013:
I'm adding a REST Service Connection to a REST Service hosted in my Intranet, which has Basic Authentication.
When I use this Data Connection as a DataList (for example on my SharePoint HomePage), i get the following Exception (in the Designer):
The Server returned a non-specific error when trying to get data from the data source.
When I look at the SharePoint Logs, I see the following Exception:
SOAP exception: System.NullReferenceException: Object reference not set to an instance of an object. at Microsoft.SharePoint.WebPartPages.DataFormWebPart.GetHierarchicalXPathNavigator(IHierarchicalDataSource ds) at Microsoft.SharePoint.WebControls.SingleDataSource.GetXPathNavigatorInternal() at Microsoft.SharePoint.WebControls.SingleDataSource.GetXPathNavigator() at Microsoft.SharePoint.SoapServer.WebPartPagesWebService.GetDataFromDataSourceControl(String dscXml, String contextUrl) 0152039d-7db3-20a8-718f-0c727b68e96b
When I open the REST URL in my Web-Browser, everything works fine.
By the way, I've already enabled the intranet-calls, so this isn't the problem:
$farm=get-spfarm
$farm.properties.disableintranetcalls=$false
$farm.properties.disableintranetcallsfromapps=$false
$farm.Update()
Thanks for your help!
Kind regards,
Peter

InitializeServiceContext in Initializer.cs has started throwing "Unauthorized" in my test app

Using the c# devkit against qbo. When i left yesterday everything was working, however today attempting to initialze the servicecontext in my test application I started getting the "Intuit.Ipp.Exception.InvalidTokenException: Unauthorized" error.
ServiceContext context = Initializer.InitializeServiceContext(oauthValidator, realmId, string.Empty, string.Empty, dataSourcetype);
and the error is here in the InitializeServiceContext:
context = new ServiceContext(oauthValidator, realmId, intuitServiceType);
I registered my test company yesterday (i.e. I now have a paid quickbooks online account) am i not allowed to continue testing against a real account? Or have i made a bigger error somewhere.
Thanks
Edit:
When trying to log into my test app on the Intuit Developer Playground I'm getting the following error:
Oops! An error has occurred.
Please close this window and try again.
Error Code: internal_error
Message: Error Authorizing Request Token: <redacted-token>
Your OAuth tokens are no longer valid. Initializing the ServiceContext object for QBO retrieves the base URL for the realm, which requires authorization and is throwing the unauthorized error as a result.