Skip to content

Latest commit

 

History

History
390 lines (298 loc) · 10.4 KB

Emmy.md

File metadata and controls

390 lines (298 loc) · 10.4 KB

Emmy

Emmy is a german rental service for electric motorbikes 🛵 (also called scooter, the wording is a mess). Currently, Emmy offers its service in Berlin, Hamburg and Munich.

General stuff

API is based on exchanging json messages. Base url: https://api.emmy.ninja

Below you find most API calls that the official emmy android app uses. However, some of them are not really tested. Additionally, there are even more API calls mostly related to the verification process (Upload video etc).

Auth

Login

curl --location --request POST 'https://api.emmy.ninja/auth/login' \
--header 'Content-Type: application/json' \
--data-raw '{
    "password": "pass",
    "username": "email"
}'

You'll receive a bunch of information related to your user. For authentication the accessToken is needed. With that, you can create the authorization header as following: Authorization: Bearer $ACCESS_TOKEN. Sometimes you need the signupToken instead of the accessToken. When ever this is needed the authorization is written that way: Authorization: Bearer $SIGNUP_TOKEN

Logout

There is also an option to log out (invalidate the accessToken?) tbc

Reset Password

curl --location --request POST 'https://api.emmy.ninja/reset-password' \
--header 'Authorization: Bearer $ACCESS_TOKEN' \
--header 'Content-Type: application/json' \
--data-raw '{
    "email": "mail@example.org"
}'

Renew Password

curl --location --request POST 'https://api.emmy.ninja/users/$USER_ID/password' \
--header 'Authorization: Bearer $SIGNUP_TOKEN' \
--header 'Content-Type: application/json' \
--data-raw '{
    "email": "mail@example.org",
    "oldPassword": "foo",
    "newPassword": "bar"
}'

Vehicle related information

Some requests work without suppling authorization as they are public information.

List vehicles

Lists all vehicles that are available for renting.

curl --location --request GET 'https://api.emmy.ninja/vehicles'

Show vehicle

Show information for a specific vehicle by $VEHICLE_ID. Get the ID by calling the general vehicles endpoint. Note: The ID seems to be auto-increment. You'll find more vehicles by simply incrementing the ID - even those that are currently not available for rental.

curl --location --request GET 'https://api.emmy.ninja/vehicles/$VEHICLE_ID'

List Vehicle Types

curl --location --request GET 'https://api.emmy.ninja/vehicles/types'

Send damage report

When you notice a damage on a vehicle before you go on a ride, you can send a damage report. Note, that you need a rentalId for it that you obtain when creating a rental on a vehicle.

curl --location --request POST 'https://api.emmy.ninja/vehicles/$VEHICLE_ID/damages' \
--header 'Authorization: Bearer $ACCESS_TOKEN' \
--data-raw '{
    "description": "A human readable description of the damage",
    "damages": [
        {
            "position": "foo",
            "type": "bar"
        }
    ],
    "rentalId": $RENTAL_ID
}' 

Rental

Create Rental

In order to create a rental, you need a $VEHICLE_ID.

curl --location --request POST 'https://api.emmy.ninja/vehicles/$VEHICLE_ID/rentals' \
--header 'Authorization: Bearer $ACCESS_TOKEN' \
--header 'Content-Type: application/json' \
--data-raw '{}'

This starts a reservation and you have 15 min time to actually start the rental. In the response you receive a rentalId that you have to store as $RENTAL_ID for later usage.

Start Rental

⚠️ Calling this method successfully will charge your account! You have to pay the price that is given in the vehicle information as pricingDuringRide.

curl --location --request POST 'https://api.emmy.ninja/vehicles/$VEHICLE_ID/rentals/$RENTAL_ID/start' \
--header 'Authorization: Bearer $ACCESS_TOKEN' \
--header 'Content-Type: application/json' \
--data-raw '{
    "isCarClean": false,
    "isCarDamaged": false,
    "isDriversLicenceWithUser": false
}'

Note: you can set all values to true or false. The API doesn't care and will start the rental either way.

Stop Rental

curl --location --request POST 'https://api.emmy.ninja/vehicles/$VEHICLE_ID/rentals/$RENTAL_ID/stop' \
--header 'Authorization: Bearer $ACCESS_TOKEN' \
--header 'Content-Type: application/json' \
--data-raw '{}'

Pause Rental

You can also pause the rental if you want to park your vehicle and but want to use it later. This will reduce the price per minute as specified in pricingDuringPark in the vehicle information

curl --location --request POST 'https://api.emmy.ninja/vehicles/$VEHICLE_ID/rentals/$RENTAL_ID/park' \
--header 'Authorization: Bearer $ACCESS_TOKEN' \
--header 'Content-Type: application/json' \
--data-raw '{}'

User relatet stuff

The API exposes some information on the user.

Create User

⚠️ This Endpoint is not tested. No valid value for languageId is known so far.

curl --location --request POST 'https://api.emmy.ninja/users' \
--header 'Content-Type: application/json' \
--data-raw '{
    "locationId": 1,
    "birthDate": "1980-01-01",
    "gender": 0,
    "firstName": "firstName",
    "lastName": "lastName",
    "email": "mail@example.org",
    "password": "password",
    "mobilePhone":"000000",
    "newsletterAccepted": false,
    "agbChecked": false,
    "planId": 1,
    "languageId": 0
}'

User Information

curl --location --request GET 'https://api.emmy.ninja/users/$USER_ID' \
--header 'Authorization: Bearer $ACCESS_TOKEN'

User Statistics

Get interesting facts such as yout total number of rides or the total ridden distance in meters.

curl --location --request GET 'https://api.emmy.ninja/users/$USER_ID/stats' \
--header 'Authorization: Bearer $ACCESS_TOKEN'

List Rentals

List all your previous rentals.

curl --location --request GET 'https://api.emmy.ninja/users/$USER_ID/rentals' \
--header 'Authorization: Bearer $ACCESS_TOKEN'

Show Rental

Show a specific rental by $RENTAL_ID.

curl --location --request GET 'https://api.emmy.ninja/users/$USER_ID/rentals/$RENTAL_ID' \
--header 'Authorization: Bearer $ACCESS_TOKEN' 

Change Address

When you change you address, the old address is still stored and returnd as part of the user information. The new address will become the new default.

curl --location --request POST 'https://api.emmy.ninja/users/$USER_ID/addresses' \
--header 'Authorization: Bearer $SIGNUP_TOKEN' \
--header 'Content-Type: application/json' \
--data-raw '{
    "firstName": "John",
    "lastName": "Doe",
    "street": "street name",
    "houseNumber": "99",
    "zipCode": "10000",
    "city": "city",
    "countryCode": "DE"
}'

Show Payment Methods

List current payment options.

curl --location --request GET 'https://api.emmy.ninja/users/$USER_ID/payment-methods' \
--header 'Authorization: Bearer $SIGNUP_TOKEN'

Payment Credit Card

⚠️ This endpoint is not tested. Correct format of values are not known.

curl --location --request POST 'https://api.emmy.ninja/users/$USER_ID/payment-methods/cc' \
--header 'Authorization: Bearer $SIGNUP_TOKEN' \
--header 'Content-Type: application/json' \
--data-raw '{
    "number": "number",
    "expirationDate": "expDate",
    "cardHolder": "cardHolder",
    "type": "type",
    "cvc": "cvc"
}'

Payment Bank Account

⚠️ This endpoint is not tested. Correct format of values are not known.

curl --location --request POST 'https://api.emmy.ninja/users/$USER_ID/payment-methods/dd' \
--header 'Authorization: Bearer $SIGNUP_TOKEN' \
--header 'Content-Type: application/json' \
--data-raw '{
    "accountHolder": "accountHolder",
    "sepaMandateCheck": false,
    "iban": "iban",
    "bic": "bic"
}'

Other stuff

Plans

List available signup plan.

curl --location --request GET 'https://api.emmy.ninja/plans'

Notifications

Sometimes, Emmy notifies its user about recent events such as an increase of prices, offline fleets because of bad weather condidition, etc.

curl --location --request GET 'https://api.emmy.ninja/notifications' \
--header 'Authorization: Bearer $ACCESS_TOKEN'

Locations

Get the business and non-parking territories.

curl --location --request GET 'https://api.emmy.ninja/locations'

Buy Credit Packages

Emmy is offering prepaid credit packages so that you can lower the price per minute.

⚠️ When submitting this request your account is charged depending on the value of $CREDIT_PACKAGE_CODE.

⚠️ This endpoint is not tested. No valid values for $CREDIT_PACKAGE_CODE are known so far. You may try one of the following: ["Asphalteuphoristen", "Gelegenheitsflaneure"] cmp. https://emmy-sharing.de/preise/

curl --location --request POST 'https://api.emmy.ninja/credit-packages/buy' \
--header 'Authorization: Bearer $ACCESS_TOKEN' \
--header 'Content-Type: application/json' \
--data-raw '{
    "code": "$CREDIT_PACKAGE_CODE"
}'

Validate Promotion Codes

⚠️ This endpoint is not tested.

Check, if a promotion code is valid an can be redeemed. You need to have a $PROMOTION_CODE that you might get from marketing actions. Use SideMenu for $REDEMPTION_PURPOSE. If you want to enter a promotion code from a friend, use Registration instead

curl --location --request POST 'https://api.emmy.ninja/promotion-codes/validate' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer $ACCESS_TOKEN' \
--data-raw '{
    "code":"$PROMOTION_CODE",
    "redemptionPurpose": "$REDEMPTION_PURPOSE"
}'

Redeem Promotion Codes

⚠️ This endpoint is not tested.

curl --location --request POST 'https://api.emmy.ninja/promotion-codes/redeem' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer $SIGNUP_TOKEN' \
--data-raw '{
    "code": "$PROMOTION_CODE",
    "redemptionPurpose": "$REDEMPTION_PURPOSE"
}'

Verification

⚠️ Currently no understanding, what this endpoint is used for.

Variable $PLATFORM must be one of the following: ["android", "ios"]

curl --location --request GET 'https://api.emmy.ninja/verification/onfido-token' \
--header 'Emmy-Application-Platform: $PLATFORM' \
--header 'Authorization: Bearer $SIGNUP_TOKEN'
verification/onfido-token

The response contains a JWT. But what is it used for?