Code Monkey home page Code Monkey logo

datamakerri's Introduction

DataMakerRI

A RESTful API for generating randomized test data as json or as SQL

run with : mvn spring-boot:run

or with : mvn spring-boot:run --debug

The Dockerized version of this application is on Docker Hub : https://hub.docker.com/repository/docker/clarkallen/datamakerri.

You can test the endpoints with OpenAPI on http://host:port/data/swagger-ui.html and also with the related project DataMakerIT which is also hosted on GitHub : https://github.com/ClarkAllen/DataMakerIT.

Some example calls to the RESTful API :

You can query for data as json or ask for the data as a SQL insert statement.

To get an insert statement you can define a table and fields like so :

PUT request
http://localhost:8080/data/v1/sql/table

with this body :

{
    "name": "MY_TABLE_NAME",
    "rows": 5,
    "startRowNum": 20,
    "fields": [
        {
            "name": "ID",
            "dmSourceType": "id"
        },
        {
            "name": "LAST_NAME",
            "dmSourceType": "lname"
        },
        {
            "name": "AGE",
            "dmSourceType": "long",
            "rangeLowEnd": 18,
            "rangeHighEnd": 120
        }
    ]
}

and the call returns something like this :

[
    "INSERT INTO MY_TABLE_NAME (ID,LAST_NAME,AGE)  ",
    "  VALUES (20,'Vega',84), ",
    "  VALUES (21,'Hall',27), ",
    "  VALUES (22,'Patton',118), ",
    "  VALUES (23,'Cook',85), ",
    "  VALUES (24,'White',51);"
]

RESTful endpoints exist for different data by type. For example, to get a randomly generated address to a person :

http://localhost:8080/data/v1/alph/address?gender=R&namefmt=FIRST_MIDDLE_LAST

Which returns something like the following :

{
    "name": "Virginia Angelica Duncan",
    "line1": "1707 Autumn ST",
    "city": "Winthrop",
    "state": "GA",
    "zip": "20443-0413"
}

You can get the pieces separately if you want :

http://localhost:8080/data/v1/alph/city

which returns a random city name :

{
    "name": "Hillsboro"
}

Get a person's name :

http://localhost:8080/data/v1/alph/person?gender=r&namefmt=LAST_FIRST

{
    "gender": "F",
    "nameFmt": "LAST_FIRST",
    "name": "Brady, Megan",
    "first": "Megan",
    "middle": "",
    "last": "Brady"
}

A pattern to be populated randomly (like serial numbers) :

PUT request
http://localhost:8080/data/v1/num/pattern

with this body :

{
    "pattern": "SN: cnnnn-nccn-Tncnnn 99",
    "charSymbol": "c",
    "numSymbol": "n"
}

can get a response like this :

{
    "value": "SN: V6419-1VU9-T1i853 99"
}

A date in some range of years :

http://localhost:8080/data/v1/date/range?lowyear=1998&highyear=2002

{
    "iso8601": "2000-08-03T03:42:09.961Z",
    "milliseconds": 965274129961
}

Get postal directionals :

http://localhost:8080/data/v1/alph/directional

{
    "shortText": "SE",
    "longText": "Southeast"
}

A random gender :

http://localhost:8080/data/v1/alph/gender?type=R

{
    "shortText": "M",
    "longText": "Male"
}

A state in the US :

http://localhost:8080/data/v1/alph/state

{
    "name": "South Carolina",
    "abbrev": "SC",
    "fipsCode": "45",
    "region": "South",
    "regionNumber": "3",
    "division": "South Atlantic",
    "divisionNumber": "5"
}

A street :

http://localhost:8080/data/v1/alph/street

{
    "street": "SW Bagnal TER APT 765"
}

A UUID :

http://localhost:8080/data/v1/alph/uuid

{
    "value": "1a25024a-abb7-4d12-91d0-5bcfd3d5ae1a"
}

A boolean :

http://localhost:8080/data/v1/bool/boolean

{
    "intValue": 0,
    "truth": false,
    "stringValue": "False"
}

A double in some long integer range :

http://localhost:8080/data/v1/num/double/range?lowEnd=10000&highEnd=50000

{
    "number": 23940.521701880156,
    "strNum": "23940.521701880156"
}

And for long integers too :

http://localhost:8080/data/v1/num/long/range?lowEnd=10000&highEnd=50000

{
    "number": 32425,
    "strNum": "32425"
}

datamakerri's People

Contributors

clarkallen avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.