Authorize.net sample code of Java SDK 1.8.6
//Common code to set for all requests
ApiOperationBase.setEnvironment(Environment.SANDBOX);
MerchantAuthenticationType merchantAuthenticationType = new MerchantAuthenticationType() ;
merchantAuthenticationType.setName(“YOUR_API_LOGIN_ID”);
merchantAuthenticationType.setTransactionKey(“YOUR_TRANSACTION_KEY”);
ApiOperationBase.setMerchantAuthentication(merchantAuthenticationType);
It uses the static method ApiOperationBase.setMerchantAuthentication. For a platform with multiple merchants, uses can not pay to different merchants at the time.
For SDK version 1.8.3,
Merchant merchant = Merchant.createMerchant(Environment.SANDBOX, apiLoginId, transactionKey);
It works for concurrency.
Can any one explain the API for 1.8.6 in case of concurrency? Thanks.
From glancing through the source code, it looks like this is still possible. You just need to use other methods instead of the static operations on ApiOperationsBase.
For the environment, call controller.execute(environment) instead of controller.execute().
For the merchant authentication, call apiRequest.setMerchantAuthentication(merchantAuthenticationType).
I haven't tested this out, exactly, but I'm pretty sure this works.
Related
I'm using a Scala Script in Glue to access a third party vendor with a dependent library. You can see the template I'm working off here
This solution works well, but runs with the parameters stored in the clear. I'd like to move those to AWS SSM and store them as a SecureString. To accomplish this, I believe the function would have to pull a CMK from KMS, then pull the SecureString and use the CMK to decrypt it.
I poked around the internet trying to find code examples for something as simple as pulling an SSM parameter from within Scala, but I wasn't able to find anything. I've only just started using the language and I'm not very familiar with its structure, is the expectation that aws-java libraries would also work in Scala for these kinds of operation? I've tried this but am getting compilation errors in Glue. Just for example
import software.amazon.awscdk.services.ssm.StringParameter;
object SfdcExtractData {
def main(sysArgs: Array[String]) {
print("starting")
String secureStringToken = StringParameter.valueForSecureStringParameter(this, "my-secure-parameter-name", 1); // must specify version
Gives a compilation error, although aws glue doesn't good job of telling me what the issue is.
Thank you for your time! If you have any code examples, insight, or resources please let me know. My job is running Scala 2 on Spark 2.4
was able to do this with the following code snippet
import com.amazonaws.services.simplesystemsmanagement.AWSSimpleSystemsManagementClient
import com.amazonaws.services.simplesystemsmanagement.model.GetParameterRequest
import com.amazonaws.services.simplesystemsmanagement.model.GetParameterResult
// create a client AWSSimpleSystemsManagementClient object
val client = new AWSSimpleSystemsManagementClient()
// Create a GetParameterRequest object, which send the actual request
val req = new GetParameterRequest()
// set the name of the parameter in the object.
req.setName("test")
// Only needed if the parameter is a secureString encrypted with the default kms key. If you're using a CMK you need to add the glue user as a key user. To do so, navigate to KMS console --> Customer Managed Keys --> Click on KMS key used for encryption --> Under Key policies --> Key user --> Add ( Add the Glue role )
req.setWithDecryption(true)
// call the getParameter() function on the object
val param = client.getParameter(req)
Remember to give your glue role iam permissions to ssm too!
My application has both UI and API.
My REST API versioning looks like below using URI versioning mechanism.
a) http://api.example.com/v1/products
b) http://api.example.com/v2/products
Note : api.example.com is my base url and my
Controller has #RequestMapping("/v1/products")
My Angular UI/UX application has below Create End-point configured in configuration "prod-env.json" file as shown below.
"prod-env.json" file :
{
"apis":
{
"createProduct": "https://api.example.com/v1/products/product"
}
}
The problem here is that each time when there is API URI versioning, I had to go and manually edit the "prod-env-json" file of my UI/UX and have to go for a release on UI side too.
Is there a way to avoid at my UI/UX manual code changes ?
(I mean is there a way that I could configure the URI using any tool like by just giving input of the new version eg : v2 and it will be placed in the URI as below)
https://api.example.com/{**new_version**}/products/product
This doesn't quite answer your question but just want to share my view.
First, normally the API version does not change regularly. So the point of automatically change the version here is not really reducing the effort to me.
Second, you don't want to tight the API version that the Frontend uses to the Backend. Especially a new API version has a high chance to break the Frontend.
So I would say, you'll want to separate them. And separate the base url/version with the path, do not duplicate them among APIs.
If you really want to implement the automatic versioning, just create an API to get the version on page load, then store that version in local/session storage for further usage.
I use a structure like this in Angular, because in the environment there must be only constants that have a global impact:
https://angular.io/guide/build
environment.prod.ts
export const environment = {
production: true,
apiHost: 'http://api.example.com',
apiVersion: '1',
}
environment.test.ts
export const environment = {
production: false,
apiHost: 'http://api-test.example.com',
apiVersion: '1',
}
apis.config.ts
import { environment } from './../environments/environment';
export const apis = {
createProduct: `${environment.apiHost}/${environment.apiVersion}/products`,
createUsers: `${environment.apiHost}/${environment.apiVersion}/users`,
}
Does anybody know how to call the REST API to get all Processes in Oracle BPM?
I already tried this without success:
http://bpm.server.com:7101/bpm/services/rest/processes
It only returns the string: "Processes.", but I need creation dates, name, id, etc...
Thanks.
Ok. It's seems that the Processes REST API is not implemented yet. Too bad.
It's is included in the WASL(/bpm/services/rest/application.wadl), but it returns the string "Processes" instead of a JSON. Follow this link for more info.
I am trying to use Stanford-parser for Ruby and get a RuntimeError: Constructor not found
I had to install 'rbj' and 'treebank' gems to get it running.
Now I can
require 'stanfordparser'
but can't get to
preproc = StanfordParser::DocumentPreprocessor.new
The funciton that returns the error is here (ruby-1.9.3-p0/gems/stanfordparser-2.2.0/lib/java_object.rb:40:in `new'):
def initialize(obj, *args)
#java_object = obj.class == String ?
Rjb::import(obj).send(:new, *args) : obj
end
I saw a couple posts on some forums about this issue, but it seems no one has figured it out.
Any ideas are greatly appreciated!
It seems like no one has updated either of the two Ruby interfaces to the Stanford Parser recently, and so there may well be interface rot, with the API changes we made in version 2.0 to accommodate multithreading.
Would it be a choice to run the parser within StanfordCoreNLP? A gem for that was written very recently and is actively being developed: stanford-core-nlp.
I'm very new in using web services. Appreciate if anyone can help me on this.
In my PHP codes, I'm trying to use the SOAP web services from another server (JIRA, java). The JIRA SOAP API is shown here.
$jirasoap = new SoapClient($jiraserver['url']);
$token = $jirasoap->login($jiraserver['username'], $jiraserver['password']);
$remoteissue = $jirasoap->getIssue($token, "issuekey");
I found that my codes have no problem to call the functions listed on that page. However, I don't know how to use the objects returned by the API calls.
My question are:
In my PHP codes, how can I use the methods in the Java class objects returned by SOAP API calls?
For example, the function $remoteissue = $jirasoap->getIssue($a, $b) will return a RemoteIssue. Based on this (http://docs.atlassian.com/rpc-jira-plugin/latest/com/atlassian/jira/rpc/soap/beans/RemoteIssue.html), there are methods like getSummary, getKey, etc. How can I use these functions in my codes?
Based on some PHP examples I found from the internet, it seems that everyone is using something like this:
$remoteissue = $jirasoap->getIssue($token, "issuekey");
$key = $remoteissue->key;
They are not using the object's methods.
Refer to this example, it seems that someone is able to do this in other languages. Can it be done in PHP too?
The problem I'm facing is that, I am trying to get the ID of an Attachment. However, it seems that we can't get the Attachment ID using this method: $attachmentid = $remoteattachment->id;. I am trying to use the $remoteattachment->getId() method.
In PHP codes, after we made a SOAP API call and received the returned objects, how do we know what data fields are available in that object?
For example,
$remoteissue = $jirasoap->getIssue($token, "issuekey");
$summary = $remoteissue->summary;
How do we know ->summary is available in $remoteissue?
When i refer to this document (http://docs.atlassian.com/rpc-jira-plugin/latest/com/atlassian/jira/rpc/soap/beans/RemoteIssue.html), I don't see it mention any data fields in RemoteIssue. How do we know we can get key, summary, etc, from this object? How do we know it is ->summary, not ->getsummary? We need to use a web browser to open the WSDL URL?
Thanks.
This question is over one year old, but to share knowledge and provide an answer to people who have this same question and found this page, here are my findings.
The document mentioned in the question is an overview of the JiraSoapService interface. This is a good reference for what functions can be called with which arguments and what they return.
If you use Java for your Jira SoapClient the returned objects are implemented, but if you use PHP, the returned objects aren't of the type stated in this documentation and do not have any of the methods mentioned. The returned objects are instances of the internal PHP class stdClass, which is a placeholder for undefined objects. The best way to know what is returned is to use var_dump() on the objects returned from the SoapCalls.
$jirasoap = new SoapClient($jiraserver['url']);
$token = $jirasoap->login($jiraserver['username'], $jiraserver['password']);
$remoteissue = $jirasoap->getIssue($token, "PROJ-1");
var_dump($remoteissue);
/* -- You will get something like this ---
object(stdClass)#2 (21) {
["id"]=> string(3) "100"
["affectsVersions"]=> array(0) { }
["assignee"]=> string(4) "user"
...
["created"]=> string(24) "2012-12-13T09:27:49.934Z"
...
["description"]=> string(17) "issue description"
....
["key"]=> string(6) "PROJ-1"
["priority"]=> string(1) "3"
["project"]=> string(4) "PROJ"
["reporter"]=> string(4) "user"
["resolution"]=> NULL
["status"]=> string(1) "1"
["summary"]=> string(15) "Project issue 1"
["type"]=> string(1) "3"
["updated"]=> string(24) "2013-01-21T16:11:43.073Z"
["votes"]=> int(0)
}
*/
// You can access data like this:
$jiraKey = $remoteissue->key;
$jiraProject = $remoteissue->project;
The document you referred to in #2 is to a Java implementation and really doesn't give you any help with PHP. If they do not publish a public API for their service (which would be unusual), then using the WSDL as a reference will let you know what objects and methods are accepted by the service and you can plan your method calls accordingly.
The technique you used to call getIssue(...) seems fine, although you should consider using try...catch in case of a SoapException.
I have used Jira SOAP in .NET project and IntelliSense hinted me what fields are available for returned object.
You can use something like VS.Php for Visual Studio or Php for Visual Studio if you are using Visual Studio.
Or you can choose one of the IDEs from here with support of IntelliSense.