Jump to content

poirpom

Member
  • Posts

    12
  • Joined

  • Last visited

Posts posted by poirpom

  1. URL was wrong, indeed. I made a mix up between the workflow example and the airtable documentation

     

    I changed the URL in the script according to the airtable documentation using this format

     

    https://api.airtable.com/v0/TABLE_ID

     

    Which, in my case, gives this :

     

    https://api.airtable.com/v0/appUQbCINAbApLJji/T%C3%A2ches

     

    Tried again. 404 disappeared, but a 422 unprocessable entity appeared instead

     

    [09:54:16.812] Create Airtable record - COPY[Keyword] Processing complete
    [09:54:16.812] Create Airtable record - COPY[Keyword] Passing output 'testing' to Run Script
    [09:54:17.629] STDERR: Create Airtable record - COPY[Run Script] Note: Unnecessary use of -X or --request, POST is already inferred.
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    
      0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0*   Trying 54.167.171.239...
    * TCP_NODELAY set
    * Connected to api.airtable.com (54.167.171.239) port 443 (#0)
    * ALPN, offering h2
    * ALPN, offering http/1.1
    * successfully set certificate verify locations:
    *   CAfile: /etc/ssl/cert.pem
      CApath: none
    * TLSv1.2 (OUT), TLS handshake, Client hello (1):
    } [230 bytes data]
    * TLSv1.2 (IN), TLS handshake, Server hello (2):
    { [89 bytes data]
    * TLSv1.2 (IN), TLS handshake, Certificate (11):
    { [4827 bytes data]
    * TLSv1.2 (IN), TLS handshake, Server key exchange (12):
    { [333 bytes data]
    * TLSv1.2 (IN), TLS handshake, Server finished (14):
    { [4 bytes data]
    * TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
    } [70 bytes data]
    * TLSv1.2 (OUT), TLS change cipher, Change cipher spec (1):
    } [1 bytes data]
    * TLSv1.2 (OUT), TLS handshake, Finished (20):
    } [16 bytes data]
    * TLSv1.2 (IN), TLS change cipher, Change cipher spec (1):
    { [1 bytes data]
    * TLSv1.2 (IN), TLS handshake, Finished (20):
    { [16 bytes data]
    * SSL connection using TLSv1.2 / ECDHE-RSA-AES128-GCM-SHA256
    * ALPN, server did not agree to a protocol
    * Server certificate:
    *  subject: CN=api.airtable.com
    *  start date: Jun 22 00:00:00 2020 GMT
    *  expire date: Jul 22 12:00:00 2021 GMT
    *  subjectAltName: host "api.airtable.com" matched cert's "api.airtable.com"
    *  issuer: C=US; O=Amazon; OU=Server CA 1B; CN=Amazon
    *  SSL certificate verify ok.
    > POST /v0/appUQbCINAbApLJji/T%C3%A2ches HTTP/1.1
    > Host: api.airtable.com
    > User-Agent: curl/7.64.1
    > Accept: */*
    > Authorization: Bearer API_KEY
    > Content-Type: application/json
    > Content-Length: 141
    > 
    } [141 bytes data]
    * upload completely sent off: 141 out of 141 bytes
    < HTTP/1.1 422 Unprocessable Entity
    < access-control-allow-headers: authorization,content-length,content-type,user-agent,x-airtable-application-id,x-airtable-user-agent,x-api-version,x-requested-with
    < access-control-allow-methods: DELETE,GET,OPTIONS,PATCH,POST,PUT
    < access-control-allow-origin: *
    < Content-Type: application/json; charset=utf-8
    < Date: Sat, 15 May 2021 07:54:17 GMT
    < ETag: W/"53-MgccoXpObT/Sg0tPHVP7Hww5eMM"
    < Server: Tengine
    < Set-Cookie: brw=brwar6XLAfvTxhlrm; path=/; expires=Sun, 15 May 2022 07:54:17 GMT; domain=.airtable.com; samesite=none; secure
    < Strict-Transport-Security: max-age=31536000; includeSubDomains; preload
    < Vary: Accept-Encoding
    < X-Content-Type-Options: nosniff
    < X-Frame-Options: DENY
    < Content-Length: 83
    < Connection: keep-alive
    < 
    { [83 bytes data]
    
    100   224  100    83  100   141    113    192 --:--:-- --:--:-- --:--:--   306
    * Connection #0 to host api.airtable.com left intact
    * Closing connection 0

     

  2. 46 minutes ago, deanishe said:

    You can’t just remove the -X. The option is -X POST. -X is the flag and POST is its value. You’ve removed half the option and now you’re telling cURL to download the URL “POST”.

     

    My bad.

     

    Corrected my mistake, tested it again and here is the data from the debugger (I simply removed both API key and table ID) 

     

    [08:27:45.354] Create Airtable record - COPY[Keyword] Processing complete
    [08:27:45.358] Create Airtable record - COPY[Keyword] Passing output 'testing' to Run Script
    [08:27:46.417] STDERR: Create Airtable record - COPY[Run Script] Note: Unnecessary use of -X or --request, POST is already inferred.
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    
      0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0*   Trying 52.44.27.144...
    * TCP_NODELAY set
    * Connected to airtable.com (52.44.27.144) port 443 (#0)
    
      0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0* ALPN, offering h2
    * ALPN, offering http/1.1
    * successfully set certificate verify locations:
    *   CAfile: /etc/ssl/cert.pem
      CApath: none
    * TLSv1.2 (OUT), TLS handshake, Client hello (1):
    } [226 bytes data]
    * TLSv1.2 (IN), TLS handshake, Server hello (2):
    { [89 bytes data]
    * TLSv1.2 (IN), TLS handshake, Certificate (11):
    { [4838 bytes data]
    * TLSv1.2 (IN), TLS handshake, Server key exchange (12):
    { [333 bytes data]
    * TLSv1.2 (IN), TLS handshake, Server finished (14):
    { [4 bytes data]
    * TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
    } [70 bytes data]
    * TLSv1.2 (OUT), TLS change cipher, Change cipher spec (1):
    } [1 bytes data]
    * TLSv1.2 (OUT), TLS handshake, Finished (20):
    } [16 bytes data]
    * TLSv1.2 (IN), TLS change cipher, Change cipher spec (1):
    { [1 bytes data]
    * TLSv1.2 (IN), TLS handshake, Finished (20):
    { [16 bytes data]
    * SSL connection using TLSv1.2 / ECDHE-RSA-AES128-GCM-SHA256
    * ALPN, server did not agree to a protocol
    * Server certificate:
    *  subject: CN=airtable.com
    *  start date: Jun 18 00:00:00 2020 GMT
    *  expire date: Jul 18 12:00:00 2021 GMT
    *  subjectAltName: host "airtable.com" matched cert's "airtable.com"
    *  issuer: C=US; O=Amazon; OU=Server CA 1B; CN=Amazon
    *  SSL certificate verify ok.
    > POST <TABLE_ID> HTTP/1.1
    > Host: airtable.com
    > User-Agent: curl/7.64.1
    > Accept: */*
    > Authorization: Bearer <API_KEY>
    > Content-Type: application/json
    > Content-Length: 141
    > 
    } [141 bytes data]
    * upload completely sent off: 141 out of 141 bytes
    < HTTP/1.1 404 Not Found
    < Cache-control: no-cache="set-cookie"
    < Content-Type: text/html; charset=utf-8
    < Date: Sat, 15 May 2021 06:27:46 GMT
    < ETag: W/"10563-BWQgW3iHu0TioWQmC3CGFAxyXrc"
    < Referrer-Policy: same-origin
    < Server: Tengine
    < Set-Cookie: brw=brweHyXOJTHdAPvv0; path=/; expires=Sun, 15 May 2022 06:27:46 GMT; domain=.airtable.com; samesite=none; secure
    < Set-Cookie: __Host-airtable-session=eyJzZXNzaW9uSWQiOiJzZXNpaUZMUVFFUXdjQ1dPayJ9; path=/; expires=Sun, 15 May 2022 06:27:46 GMT; samesite=none; secure; httponly
    < Set-Cookie: __Host-airtable-session.sig=WxLPyOfKexKnH3MMgAv4nF3Cs_AkL3zI3ZNkONlYAIU; path=/; expires=Sun, 15 May 2022 06:27:46 GMT; samesite=none; secure; httponly
    < Set-Cookie: AWSELB=F5E9CFCB0C87D62DB5D03914FDC2A2D2D45FBECE920025D3C55287816E4AE3E4B24EF7E36B91AC3560650744EDFEAB3519A6F71FB93A2BB4F5796755FDCDE92BC243D7D585;PATH=/
    < Set-Cookie: AWSELBCORS=F5E9CFCB0C87D62DB5D03914FDC2A2D2D45FBECE920025D3C55287816E4AE3E4B24EF7E36B91AC3560650744EDFEAB3519A6F71FB93A2BB4F5796755FDCDE92BC243D7D585;PATH=/;SECURE;SAMESITE=None
    < Strict-Transport-Security: max-age=31536000; includeSubDomains; preload
    < Vary: Accept-Encoding
    < X-Content-Type-Options: nosniff
    < X-Frame-Options: SAMEORIGIN
    < X-XSS-Protection: 1; mode=block
    < Content-Length: 66915
    < Connection: keep-alive
    < 
    { [15102 bytes data]
    
    100 67056  100 66915  100   141  68490    144 --:--:-- --:--:-- --:--:-- 68564
    * Connection #0 to host airtable.com left intact
    * Closing connection 0

     

  3. Hi all,

     

    I'm having trouble to make it happen.

     

    On 9/29/2017 at 3:58 PM, benh said:

    In this example, you'll need to tweak the script:

     

    1. add your API key where it says YOUR_API_KEY (get it from airtable.com/account)

    2. add the URL to your base where it says YOUR_TABLE_URL

    3. change the fields (e.g. Title, Status) to match your table

     

    I did follow these steps, referred to the airtable API documentation to double check, and tried adding a record but nothing happened

     

    curl -v POST https://api.airtable.com/v0/TABLE_ID \
      -H "Authorization: Bearer API_KEY" \
      -H "Content-Type: application/json" \
      --data '{
      "fields": {
        "Tâche": "{query}",
        "Tous les X": 1,
        "Fréquence": "mois",
        "Notes": "bla bla bla",
        "Type": "PRO"
      }
    }'

     

    As you may notice, I simply removed -X between -v and POST as the debugger inside Alfred said it was unnecessary :

     

    Note: Unnecessary use of -X or --request, POST is already inferred.

     

    (I first tried with -X — nothing happened as well.)

     

    When I look at the debugger, connection is established, data seems transferred (as far as i can understand, though). But nothing appears on airtable side.

     

    I confess I'm a total beginner here, but it seems i'm on the right path, close to making it happen.

     

    Maybe your eyes can see something I don't.

     

    Thanks for your advice.

    CleanShot 2021-05-14 at 20.48.13.png

  4. 13 minutes ago, deanishe said:

     

    I’m pretty sure the problem is the extra modifier key () you need to press to get \ on your keyboard.


    The app isn’t expecting it because Notion didn't consider that some keyboard don’t have a key for \.

     

    I agree. 

     

    2 minutes ago, giovanni said:

    @poirpomthe hover issue should not matter, because I was able to hide the sidebar running the applescript from script editor and terminal.

    Would remapping the actual key (with Karabiner or similar) be a solution here? 

     

    You're right. I'll have a try with karabiner to see if I can find a way around

     

    Regarding keysmith, hover is an issue, as keysmith emulates actual clicks on your screen (placing your mouse cursor where it has to click) but isn't able to emulate a mouse move, therefore the button to hide the sidebar doesn't appear.

  5. @giovanni & @deanishe

     

    Thank you both for your detailed answers.

     

    Unfortunately, none of those solutions worked. Even through the script editor (and I checked : it has accessibility permissions.)

     

    It's weird because I tried with a different key code (44 → = sign on a french keyboard) to emulate the zoom in (with ⌘) and it worked.

     

    I've been able to solve other keyboard shorcuts issues I had with Keysmith, but as this ability (hiding the side bar) in notion appears only on hover, keysmith isn't able to solve it (I've been in contact with them to try to figure it out)

     

    So it seems you are right, deanishe. I should ask notion to see if there's a work around.

     

    Thank you again for taking the time to answer me

  6. 1 hour ago, giovanni said:

    welcome to the forum!

    Have you tried to launch a simple applescript like this below? 

    
    tell application "Notion" to activate
    tell application "System Events" to key code 42 using command down

     

    Hi giovanni

     

    Thanks for your answer and the welcome.

     

    I tried what you just said (see screenshots, just to be sure I did it right).

     

    What happens in Notion when I use my hotkey : it types the character ` (counter tick, if i'm correct).

     

    Is there something I'm doing wrong ? Sorry, I'm completely new to scripts and not sure at all.

    CleanShot 2021-04-27 at 19.05.28.png

    CleanShot 2021-04-27 at 19.05.08.png

    CleanShot 2021-04-27 at 19.06.22.gif

  7. Hi all,

     

    Fabrice/poirpom here. I live in France*. This my is first post in this forum.

     

    *Therefore my ability to write or understand english is far from perfection. Apologize my mistakes.

     

    To provide a little bit of context :

    • Happy powerpack Alfred user from more than 3 years, I enjoy using it every single day (29.7 times a day on average according to the usage stats provided, up to 150 on a single day).
    • Although I have no knowledge at all in scripting, I find ways to achieve very helpful stuff with Alfred every day, thanks to the basic but powerful tools provided to create workflows.
    • Another piece of software/SaaS I use a lot is Notion. Combining Alfred and a wonderful web browser extension called Save to notion, I've been able to add content to a notion database thanks to a single workflow

     

    Enough with the context.

     

    Regarding Notion, I'm trying to solve a "localized problem" :

    • Notion provides a keyboard shortcut to show/hide the sidebar ⌘+\
    • Unfortunately, this shortcut doesn't work on a french keyboard. Because the character \ is done with the combination ⌥ + ⇧ + /
    • I thought I could find a find to emulate the required combination (⌘+\) by : 
      • activating a workflow with a hotkey of my choice (only when Notion has focus)
      • setting an argument ⌘\ (I've tried with both options – pass through input argument selected and not selected)
      • using a key combo output with the override with input argument selected

     

    Obviously, nothing happens. But I don't even know if what I'm trying to achieve can be done with Alfred, if I'm on the right path or completely wrong (that won't be the first time).

     

    Any piece of advice would be really appreciated.

     

    Thanks in advance.

     

    CleanShot 2021-04-27 at 15.18.23.png

×
×
  • Create New...