Skip to content

Instantly share code, notes, and snippets.

@coolaj86
Last active October 18, 2022 20:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save coolaj86/b02a3919bd6cd2591ba615cfdeacc1f9 to your computer and use it in GitHub Desktop.
Save coolaj86/b02a3919bd6cd2591ba615cfdeacc1f9 to your computer and use it in GitHub Desktop.

Node.js request

Same as

curl -X POST https://api.mercury.com/api/v1/submit-onboarding-data \
    -H 'Content-Type: application/json' \
    -H 'Accept: application/json' \
    -d '@./application.json'

Node.js request object:

{
  "method": "POST",
  "url": "https://api.mercury.com/api/v1/submit-onboarding-data",
  "json": {
    "partner": "REDACTED-base64-partner-id",
    "webhookURL": "https://mercury-demo.duckdns.org/api/webhooks/mercury",
    "about": {
      "legalBusinessName": "ACME, Inc",
      "website": "acme.com",
      "industry": "mercury_consulting",
      "countryOfOperation": "US",
      "description": "We're a company that makes everything.",
      "operations": "LocalBusiness"
    },
    "businessContactDetails": {
      "address1": "123 Sesame St",
      "address2": "Big Bird's House",
      "city": " New York City",
      "state": "NY",
      "postalCode": "10023",
      "phoneNumber": "+15555551234"
    },
    "beneficialOwners": [
      {
        "firstName": "Big",
        "lastName": "Bird",
        "jobTitle": "Other",
        "email": "CHANGE_ME@EXAMPLE.COM",
        "percentOwnership": 100,
        "citizenshipStatus": "USCitizen",
        "identificationType": "DriversLicense",
        "address1": "123 Sesame St",
        "city": " New York City",
        "state": "NY",
        "country": "US",
        "postalCode": "10023",
        "phoneNumber": "+15555552345",
        "isPep": "IsPep",
        "otherJobTitle": "Owner",
        "dateOfBirth": "1969-11-10",
        "identificationBlob": "data:image/jpeg;name=${urlIdFilename};base64,${idDoc64}"
      }
    ],
    "formationDetails": {
      "companyStructure": "LLC",
      "federalEin": "12-3456789",
      "formationDocumentType": "OtherBusinessDocumentation",
      "formationDocumentFileBlob": "data:application/pdf;name=${urlBizFilename};base64,${bizDoc64}",
      "eINDocumentFileBlob": "data:application/pdf;name=${urlEinFilename};base64,${einDoc64}"
    },
    "businessDetails": {
      "USOperations": "We provide consulting services to US customers.",
      "WebPresence": "https://github.com/acme/, https://www.linkedin.com/company/acme",
      "InvalidWebsite": "https://acme.com/"
    },
    "inviteEmail": "CHANGE_ME@EXAMPLE.COM"
  }
}
{
  "debugInfo": "When parsing Model.APIPartner.APIPartner expected a String with the tag of a constructor but got REDACTED-base64-partner-id.",
  "errors": {
    "jsonParse": [ "Error parsing JSON; please contact help@mercury.com." ]
  }
}
{
  "method": "POST",
  "url": "https://api.mercury.com/api/v1/submit-onboarding-data",
  "json": {
    "partner": "",
    "webhookURL": "",
    "about": {
      "legalBusinessName": "ACME, Inc",
      "website": "acme.com",
      "industry": "mercury_consulting",
      "countryOfOperation": "US",
      "description": "We're a company that makes everything.",
      "operations": "LocalBusiness"
    },
    "businessContactDetails": {
      "address1": "123 Sesame St",
      "address2": "Big Bird's House",
      "city": " New York City",
      "state": "NY",
      "postalCode": "10023",
      "phoneNumber": "+15555551234"
    },
    "beneficialOwners": [
      {
        "firstName": "Big",
        "lastName": "Bird",
        "jobTitle": "Other",
        "email": "CHANGE_ME@EXAMPLE.COM",
        "percentOwnership": 100,
        "citizenshipStatus": "USCitizen",
        "identificationType": "DriversLicense",
        "address1": "123 Sesame St",
        "city": " New York City",
        "state": "NY",
        "country": "US",
        "postalCode": "10023",
        "phoneNumber": "+15555552345",
        "isPep": "IsPep",
        "otherJobTitle": "Owner",
        "dateOfBirth": "1969-11-10",
        "identificationBlob": "data:image/jpeg;name=${urlIdFilename};base64,${idDoc64}"
      }
    ],
    "formationDetails": {
      "companyStructure": "LLC",
      "federalEin": "12-3456789",
      "formationDocumentType": "OtherBusinessDocumentation",
      "formationDocumentFileBlob": "data:application/pdf;name=${urlBizFilename};base64,${bizDoc64}",
      "eINDocumentFileBlob": "data:application/pdf;name=${urlEinFilename};base64,${einDoc64}"
    },
    "businessDetails": {
      "USOperations": "We provide consulting services to US customers.",
      "WebPresence": "https://github.com/acme/, https://www.linkedin.com/company/acme",
      "InvalidWebsite": "https://acme.com/"
    },
    "inviteEmail": "CHANGE_ME@EXAMPLE.COM"
  }
}
{
  "debugInfo": "When parsing Model.APIPartner.APIPartner expected a String with the tag of a constructor but got .",
  "errors": {
    "jsonParse": [ "Error parsing JSON; please contact help@mercury.com." ]
  }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment