1.0.0 • Published 5 years ago

api.getscribeware.com v1.0.0

Weekly downloads
-
License
MIT
Repository
-
Last release
5 years ago

ScribeWare Server API

This project contains various APIs used by the ScribeWare client.

This is a serverless managed project.

Stripe Metadata

Various attributes are stored using the metadata attributes on stripe:

Stripe.customer

  • parentStripeId: Specifies the stripe id responsible for billing for this account.

Stripe.plan

  • isAddon: items that are "addons" to other plans, such as server storage. There should only be one plan that is not an addon for a given user's subscription
  • isTrial: This is a trial plan
  • isUnlimited: This plan includes unlimited reports
Stripe.plan (to be deprecated after existing customers switch to metered plans)
  • reports: # of reports included per billing cycle
  • extraReportCost: cost (in cents) of each published report beyond the number specified in reports

Testing

Currently (2/13/18) jest can't load stripe. Might be a configuration issue with webpack? Not sure.

A local API server can be run without deploying to AWS. Simply do:

npm start

Then run scribeware via

API_SERVER=http://localhost:3000/ gulp

You can also hit APIs directly using curl. Some useful examples:

curl -H "Content-Type: application/json" -H "Authorization: e4ed6693-fbb9-4800-85f1-f6e908c90131" -H "X-Client-Version: xyz" -X POST -d '{"creditsUsedSinceLastUpdate":1}' http://localhost:3000/v1/user/status

curl -H "Content-Type: application/json" -H "Authorization: 7596b2d2-a67c-4d83-92a7-aaee8c2ce99d" -X POST http://localhost:3000/v1/client/create-dbs

using https://httpie.org/

(Remember, emailId must be unique!)

http POST https://dev-api.getscribeware.com/v1/emails/send Authorization:test-client-id \
  emailType='publish' \
  sender='Joe Tester' \
  from='tester <test@stevelamb.io>' \
  to='Lake Steve <steve@lakere.com>; Steve lamb<steve@stevelamb.io>' \
  bcc='bcc@test.com' \
  subject='test subject' \
  body='test body' \
  reportId='rep:123'

couchdb

Hosted on EC2 as data.getscribeware.com with haproxy frontend

to update cloudwatch config:

sudo vim /opt/aws/amazon-cloudwatch-agent/bin/config.json
sudo /opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-ctl -a fetch-config -m ec2 -c file:vim /opt/aws/amazon-cloudwatch-agent/bin/config.json

or

sudo /opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-config-wizard
sudo /opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-ctl -a fetch-config -m ec2 -c ssm:AmazonCloudWatch-linux