Airtable API connectivity

  1. 5 years ago

    VinDo

    9 May 2018 User since 2018

    I am using the HTTPClient and HTTPRequest to connect to Airtable API.
    The connection works - if I use the api_key as a query
    And the request returns all the records in an airtable base
    I am trying to restrict the HTTPRequest to querying for only one record in the base. I can’t work out how to configure the HTTPClient with a ‘variable’ - the API takes the record id as part of the url.
    Any thoughts?

  2. andrea

    9 May 2018 Administrator User since 2016
    Edited 5 years ago by andrea

    Hi @VinDo ,
    I don't know this particular API from Airtable, however, you can configure a query parameter of an HTTPRequest by writing directly the variable in the request URL or by setting it in the Query parameters (see the attached image).
    The query parameter can be then changed by accessing it like a property of the HTTPRequest, for example:
    HTTPClient1.Request.recordID = 12345; HTTPClient1.Request.run();

    If you need any help or further information please send me your project.

  3. henry_cho

    12 May 2018 User since 2018

    Hi @andrea, I have the same question.
    The issue with airtable's API is that it uses a the url structure to access a record rather than a query.
    eg.https://api.airtable.com/v0/app2qdjo13RWolJqT/simple%20consumption/recKCUodTOOlsRtMA \

    where recKCUodTOOlsRtMA identifies the record.
    Is there a way to dynamically rewrite the request URL ?
    Keeping in mind that the method you outlined above would create a URL like
    https://api.airtable.com/v0/app2qdjo13RWolJqT/simple%20consumption/?recKCUodTOOlsRtMA \

    Note the addition of the "?" in the URL.

    Could you use
    var host: String Hostname of the HTTP server ?

  4. VinDo

    14 May 2018 User since 2018

    This structure works...
    Airtable.host = AirtableURL + "/" + Record;
    Airtable.Request.run();

    where:
    Airtable is a HTTPClient - that has the Airtable base URL (using the query for the air_key)
    AirtableURL is the base URL in a variable
    Record is the unique id of the record (as used by Airtable)
    Airtable.Request is the HTTPRequest call

    (I'm using a variation of the LetsCook tutorial - using a HTTPClient instead of the local SQL - and still struggling to get the HTTPRequest to update the second window...)

  5. andrea

    23 May 2018 Administrator User since 2016
    Edited 5 years ago by andrea

    Hi, in the new version 1.0b21 released today contains various improvements to the HTTPRequest class.

    If you need variable components of the path, you can now add entries in the path section of the parameters in the inspector (see attached image). Then you can move the token at the desired position of the path. The HTTPRequest instance will replace this token with the current value of that property when executing the run() method. If you want to change the value of that token, you can set it programmatically with the name of the token, for example for a token named recordID you can do:

    HTTPClient1.Request.recordID = 12345;

    Or you can change the path tokens by overriding the value of the pathParameters Map:

    HTTPClient1.Request.pathParameters = ["recordID" : "12345"];

    @VinDo, can you please give me more datails on this issue:

    (I'm using a variation of the LetsCook tutorial - using a HTTPClient instead of the local SQL - and still struggling to get the HTTPRequest to update the second window...)

or Sign Up to reply!