I have written a couple of APEX Classes for use in our Salesforce Flows; and they work great.
I am now looking for some information on writing Unit Tests for the DocuSign API's.
The blog post https://www.docusign.com/blog/dsdev-apex-toolkit-salesforce-appexchange/ makes mention of a couple of HTTP Mock Classes (https://developers.docusign.com/salesforce/apex-toolkit-reference/usermock.html) and (https://developers.docusign.com/salesforce/apex-toolkit-reference/esignatureapimock.html) however these URL's do not appear to work.
Does anyone know or have access to the Mock classes or know where I can gain access?
Thank you!
Unfortunately this is a documentation error. The mocks should exist in the code, look for dfsle.UserMock and dfsle.ESignatureAPIMock
But we don't yet have documentation for them. I have filed DocuSign internal bug report DFS-5699 to have this fixed.
Related
As a school assignment I have to make the following:
Overview
Create a React SPA which does the following:
Authenticates against (Welcome to the IdentityServer4 demo site) using the authorization code flow with PKCE
Calls (test) using the correct token
Detail
Create a SPA in React. Usage of React is mandatory this time.
add a library which adds OIDC protocol support to the SPA. Make sure the authorization code flow with PKCE is supported
use (Welcome to the IdentityServer4 demo site)as your authorization server. This authorization server supports the authorization code flow with PKCE
call (test) using the correct token and show the results back to the user
host the react app on Netlify
As a beginner in this field, I totally don’t understand the assignment. Can anybody help me out?
Edit - welcome to SO! Be nice here and help other people.
In the interest of being nice, here are some pointers and a solution to your assignment. But please, please, please - don't just copy it, learn how it works, think it through, apply it to your own react app.
First of all, while identityserver has very good documentation at https://identityserver4.readthedocs.io/ - it is very code-oriented and might be hard to start with.
So instead, take a look aut Auth0, a competing commercial product. They have pretty good docs as well, and they explain some of the protocols too.
https://auth0.com/docs/protocols/oauth2
https://auth0.com/docs/flows/concepts/auth-code-pkce
These are of particular interest.
Now, they also have scenarios like the one you need to implement. You might think it's this one: https://auth0.com/docs/architecture-scenarios/spa-api but they are a little behind in the new guidelines (but luckily your assignment isn't) that SPA's should also use code flow with PKCE, so you're better off with this: https://auth0.com/docs/architecture-scenarios/mobile-api
(more on why this is better here: https://brockallen.com/2019/01/03/the-state-of-the-implicit-flow-in-oauth2/)
Having read all that, you need to find a good JS library that does oidc/oauth for you. No use in writing one yourself in school unless you're going for a Phd.
Google javascript oidc -> https://github.com/IdentityModel/oidc-client-js comes up. Hey! It's those guys from identityserver again. They're great people, aren't they? They've certainly got your back.
Now google react oidc-client-js - well isn't that nice, someone beat you to it: https://github.com/skoruba/react-oidc-client-js
That should get you started. Like I said, please don't make me regret this and take the trouble and time to actually learn this stuff. It could lead to an interesting line of work later on :-)
I'm trying to call a SuccessFactors API to update some data from a Logic App.
But I keep running into an "Unauthorized" error.
How can I get some more details about this error? Can't see input-output for this action so it's a bit difficult.
Kind Regards
Tim
I ended up trying to mimic the call in an online REST test tool. That gave me the error I was looking for.
SuccessFactors has some settings on user level to only allow logins for certain ip's. If I add the logic app IP's, it works.
I'm building some reporting tool. Ideally I want to avoid going through web server logs myself and use (some of) the power of Piwik.
The stuff I get from the visitor log would be a good start, this is at http://example.com/piwik/index.php?module=CoreHome&action=index&idSite=1&period=day&date=yesterday#/module=Live&action=getVisitorLog&idSite=1&period=day&date=yesterday
Unfortunately I can't find a getVisitorLog action in the HTTP API docs at
http://developer.piwik.org/api-reference/reporting-api#Actions (and it's also not an undocumented feature, method=Actions.getVisitorLog gives me
The method 'getVisitorLog' does not exist or is not available in the module '\Piwik\Plugins\Actions\API'.
Is there another way to get to this? Or should I write a plugin for Piwik?
Apparently it is possible through the Live plugin API:
http://developer.piwik.org/api-reference/reporting-api#Live
This works as desired:
http://example.com/piwik/index.php?module=API&method=Live.getLastVisitsDetails&format=JSON&idSite=1&period=day&date=2015-07-21&expanded=1&token_auth=XXXXX&filter_limit=100
I'm transitioning towards more responsive front-end web apps and I have a question about model validation. Here's the set-up: the server has a standard REST API for inserting, updating, retrieving, etc. This could be written in Node or Java Spring, it doesn't matter. The front-end is written with something like Angular (or similar).
What I need is to figure out where to put the validation code. Here's the requirements:
All validation code should be written in one place only. Not both client and server. this implies that it should reside on the server, inside the REST API when persisting.
The front-end should be capable of understanding validation errors from the server and associating them to the particular field that caused the error. So if the field "username" is mandatory, the client can place an error next to that field saying "Username is mandatory".
It should be possible to validate correct variable types. So if we were expecting a number or a date and got a string instead, the error would be something like "'Yo' is not a correct date."
The error messages should be localized to the user's language.
Can anyone help me out? I need something simple and robust.
Thanks
When validating your input and it fails you can return a response in appropriate format (guessing you use JSON) to contain the error messages along with a proper HTTP error code.
Just working on a project with a Symfony backend, using FOSRestBundle to provide proper REST API. Using the form component of Symfony whenever there's a problem with the input a well structured JSON response is generated with error messages mapped to the fields or the top level if for example there's unexpected input.
After much research I found a solution using the Meteor.js platform. Since it's a pure javascript solution running on both the server and the client, you can define scripts once and have them run on both the client and the server.
From the official Meteor documentation:
Files outside the client, server and tests subdirectories are loaded on both the client and the server! That's the place for model definitions and other functions.
Wow. Defining models and validation scripts only once is pretty darn cool if you ask me. Also, there's no need to map between JSON and whatever server-side technology. Plus, no ORM mapping to get it in the DB. Nice!
Again, from the docs:
In Meteor, the client and server share the same database API. The same exact application code — like validators and computed properties — can often run in both places. But while code running on the server has direct access to the database, code running on the client does not. This distinction is the basis for Meteor's data security model.
Sounds good to me. Here's the last little gem:
Input validation: Meteor allows your methods and publish functions to take arguments of any JSON type. (In fact, Meteor's wire protocol supports EJSON, an extension of JSON which also supports other common types like dates and binary buffers.) JavaScript's dynamic typing means you don't need to declare precise types of every variable in your app, but it's usually helpful to ensure that the arguments that clients are passing to your methods and publish functions are of the type that you expect.
Anyway, sounds like I've found the a solution to the problem. If anyone else knows of a way to define validation once and have it run on both client and server please post an answer below, I'd love to hear it.
Thanks all.
To be strict, your last gate keeper of validation for any CRUD operations is of course on server-side. I do not know what is your concern that you should handle your validation on one end only(either server or client), but usually doing on both sides is better for both user experience and performance.
Say your username field is a mandatory field. This field can be easily handled in front-end side; before a user click submit and then been sent to the server and then get returned and shows the error code. You can save that round trip with a one liner code in front-end.
Of course, one may argue that from client-side the bad guys may manipulate the data and thus bypassing the front-end validation. That goes to my first point - your final gate keeper in validation should be on your server-side. That's why, data integrity is still the server's job. Make sure whatever that goes into your database is clean, dry and valid.
To answer you question, (biased opinion though) AngularJS is still a pretty awesome framework to let you do front-end validation, as well as providing a good way to do server-side error handling.
Is there a way, or is there a web site that can run test cases against another REST server?
On the "tester" website you'd say: do this PUT on this URI, using this authentication mechanism, using this JSON string, with this header, etc. If the result contains XYZ then consider it a success, otherwise consider it a failure...
Other users should be able to add new test cases and edit existing test cases.
I wanted to check before writing a combination of wiki, google app engine, selenium, etc.
Thanks.
Its not what you probably search for, but still probably worth the check: SimpleTestIO
That project's goal is to be easier than Selenium and easy to use. In the future will be probably paid.
Disclaimer: I am not connected with the page, just found it while researching for Selenium alternatives