Git Product home page Git Product logo

fm-uri's Introduction

fm-uri

fm-uri

Revolutionize Your Workflow: Unleash the Power of fm-uri, Your Ultimate Claris/FileMaker Pro Companion for Seamless URL Mastery!
Explore the docs »

Report Bug · Request Feature

FileMaker Version FileMaker Platform Commit Shield Contributors MIT License Facebook LinkedId

Table of Contents
  1. About The Project
  2. Features
  3. Getting Started
  4. Usage
  5. Contributing
  6. License
  7. Contact
  8. Acknowledgments

About The Project

Introducing fm-uri, a compact yet powerful custom function tailored for Claris/FileMaker users! This innovative function seamlessly dissects any URL, extracting its vital components and elegantly presents them to you.

As the demand for bridging Claris/FileMaker with the expansive realms of AWS and REST APIs continues to grow, fm-uri emerges as the indispensable solution. Elevate your experience by effortlessly navigating and leveraging the intricate details of URLs with this essential tool. Streamline your workflow and embrace the synergy between Claris/FileMaker and the dynamic world of modern APIs. Uncover the potential of fm-uri as it empowers you to seamlessly integrate and unlock new possibilities in your endeavors.

Built With

Features

  • Effortless URL Parsing: Seamlessly dissect any URL, effortlessly extracting its vital components for streamlined use.
  • Intuitive Functionality: A user-friendly custom function that takes a URL and a key, providing specific parts of the URL with simplicity and precision.
  • Versatility without 3rd Party Dependencies: Built exclusively for Claris Pro with no reliance on third-party plugins, ensuring reliability and independence.
  • Modern JSON Function Integration: Utilizes the power of JSON Functions introduced in FileMaker 16 for a modern and efficient user experience.
  • Extensive Key Options: Choose from a comprehensive list of keys to retrieve specific URL details, offering flexibility and customization.

Elevate your Claris/FileMaker experience with fm-uri, where innovation meets practicality, and URL mastery becomes an integral part of your dynamic workflow.

Getting Started

Prerequisites

To make the most of fm-uri, ensure your Claris/FileMaker environment meets the following prerequisites:

  • FileMaker Version: The custom function relies on the JSON Functions introduced in FileMaker 16. Therefore, it is compatible with FileMaker 16 and later versions.

Note: Using this custom function with versions earlier than FileMaker 16 may result in unexpected behavior.

With these prerequisites in place, you can seamlessly integrate fm-uri into your Claris/FileMaker workflow, unlocking its full potential for URL mastery.

Limitations

Query String Handling

The queryJson key currently has limitations in handling certain types of query strings, specifically those attempting to encode array parameters. For example:

foo[]=1&foo[]=2

The result will be:

{"foo[]":"1","foo[]":"2"}

Additionally, the queryJson key does not encode integers, resulting in all values being encoded as strings.

Usage

Installation

Integrating fm-uri into your Claris/FileMaker file is a breeze. Follow these simple steps:

  1. Open the fm-uri.fmfn file.
  2. Copy the code directly from the file.
  3. Paste the code into the custom function area of your Claris/FileMaker file.

That's it! You're ready to harness the power of fm-uri for seamless URL management.

Understanding the different URL parts

Below is a representation of how we break up the url

              origin
       __________|__________
      /                     \
                         authority
     |             __________|_________
     |            /                    \
              userinfo                host                          resource
     |         __|___                ___|___                 __________|___________
     |        /      \              /       \               /                      \
         username  password     hostname    port     path & segment      query   fragment
     |     __|___   __|__    ______|______   |   __________|_________   ____|____   |
     |    /      \ /     \  /             \ / \ /                    \ /         \ / \
    foo://username:[email protected]:123/hello/world/there.html?name=ferret#foo
    \_/                     \ / \       \ /    \__________/ \     \__/
     |                       |   \       |           |       \      |
  scheme               subdomain  \     tld      directory    \   suffix
                                   \____/                      \___/
                                      |                          |
                                    domain                   filename

Function

The function signature is straightforward and powerful:

/**
 * fm-uri ( url ; key )
 *
 * @author Steven McGill <[email protected]>
 * @param  string  url    The url you want to break up
 * @param  string  key    The url part you want to return
 * 
 * @return string|object  Can either be a string or JSON object when key = all
 *
*/

fmUri ( url ; key );

Keys

Tailor your URL extraction with a variety of keys available in the custom function:

scheme

protocol can also be used and is an alias of scheme

fmUri ( "http://example.org/foo/hello.html" ; "scheme" ) // returns "http"

fmUri ( "http://example.org/foo/hello.html" ; "protocol" ) // returns "http"

username

fmUri ( "http://user:[email protected]/foo/hello.html" ; "username" ) // returns "user"

password

fmUri ( "http://user:[email protected]/foo/hello.html" ; "password" ) // returns "pass"

hostname

fmUri ( "http://example.org/foo/hello.html" ; "hostname" ) // returns "example.org"

port

fmUri ( "http://example.org:8080/foo/hello.html" ; "hostname" ) // returns "8080"

host

fmUri ( "http://example.org:80/foo/hello.html" ; "host" ) // returns "example.org:80"

userinfo

Userinfo is comprised of username and password

fmUri ( "http://user:[email protected]:88/foo/hello.html" ; "userinfo" ) // returns "user:pass"

authority

Authority is comprised of username, password, hostname and port

fmUri ( "http://user:[email protected]:88/foo/hello.html" ; "authority" ) // returns "user:[email protected]:88"

origin

Origin is comprised of the scheme and authority.

fmUri ( "http://example.com/foo.html?q=hello" ; "origin" ) // returns "http://example.com"

domain

fmUri ( "http://example.org/foo/hello.html" ; "domain" ) // returns "example.org"

subdomain

fmUri ( "http://example.org/foo/hello.html" ; "subdomain" ) // returns "example.org"

tld

fmUri ( "http://example.org/foo/hello.html" ; "tld" ) // returns "org"

pathname

path can also be used and is an alias of pathname

fmUri ( "http://example.org/foo/hello.html" ; "pathname" ) // returns "/foo/hello.html"
fmUri ( "http://example.org/foo/hello.html" ; "path" ) // returns "/foo/hello.html"

directory

fmUri ( "http://example.org/foo/hello.html" ; "directory" ) // returns "/foo" (no trailing slash)

filename

fmUri ( "http://example.org/foo/hello.html" ; "filename" ) // returns "hello.html" (no leading slash)

suffix

fmUri ( "http://example.org/foo/hello.html" ; "suffix" ) // returns "html" (no leading dot)

search

fmUri ( "http://example.org/foo/hello.html?foo=bar&bar=baz" ; "search" ) // returns "?foo=bar&bar=baz" (leading ?)

query

fmUri ( "http://example.org/foo/hello.html?foo=bar&bar=baz" ; "query" ) // returns "foo=bar&bar=baz" (no leading ?)

queryJson

fmUri ( "http://example.org/foo/hello.html?foo=bar&bar=baz" ; "query" ) // returns "{"foo":"bar","bar":"baz"}"

hash

fmUri ( "http://example.org/foo/hello.html#world" ; "hash" ) // returns "#world" (leading #)

fragment

fmUri ( "http://example.org/foo/hello.html#world" ; "fragment" ) // returns "world" (no leading #)

resource

fmUri ( "http://example.org/foo/hello.html?query=string#hash" ; "resource" ) // returns "/foo/hello.html?query=string#hash"

all

fmUri ( "foo://username:[email protected]:123/hello/world/there.html?name=ferret#foo" ; "all" )
/**
 * returns
 * {
 *  "authority": "username:[email protected]:123",
 *  "directory": "/hello/world",
 *  "domain": "example.com",
 *  "filename": "there.html",
 *  "fragment": "foo",
 *  "hash": "#foo",
 *  "host": "www.example.com:123",
 *  "hostname": "www.example.com",
 *  "origin": "foo://username:[email protected]:123",
 *  "password": "password",
 *  "path": "/hello/world/there.html",
 *  "pathname": "/hello/world/there.html",
 *  "port": "123",
 *  "protocol": "foo",
 *  "query": "name=ferret",
 *  "resource": "/hello/world/there.html?name=ferret#foo",
 *  "scheme": "foo",
 *  "search": "?name=ferret",
 *  "subdomain": "www",
 *  "suffix": "html",
 *  "tld": "com",
 *  "userinfo": "username:password",
 *  "username": "username"
 * }
 * 

Contributing

Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature)
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

License

Distributed under the MIT License. See LICENSE for more information.

Contact

Steven McGill - WhiteSpace Systems Ltd - [email protected]

Acknowledgements

fm-uri's People

Contributors

stevenwhitespacesystems avatar

Watchers

 avatar  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.