Log In

Log In



Not registered yet?


Reset password Activation link

Forums ~ REST API

Received 401 Unauthorized response with REST request
January 12, 2017
Completed
0
 

carusyte
January 12, 2017

I am trying to fetch all form records using the documented pattern ‘/apps/APP_ID/dtypes/entity/ENTITY_ID.json’ in Java 8, with Retrofit2, and Gson to handle JSON stuff, but I received 401 response no matter how I try.
The complete URL can produce valid response in Chrome browser, but receives only brackets([]) in Safari.
I tried to set an API key in the body, but the Retrofit framework complained that body is not acceptable in a GET method. That seems to violate the specifications of HTTP 1.1.
Then I tried to use POST method instead, got the same 401 response.
I have no idea. Is there any operational sample written in Java?



Igor Petrushenko
January 12, 2017

You receive results in browser, because you are logged in.
But in order to get result from your script, you should pass API key to authorize.
Otherwise you’ll keep getting 401 error.



carusyte
January 12, 2017

The REST API I’m using wouldn’t allow me to send a GET method with body in it. I googled a bit and they say it has something to do with the HTTP/1.1 specification. I’m not sure. Maybe I’d try another REST API to do the job.



Igor Petrushenko
January 12, 2017

But it’s not a body, it’s just a parameter needs to be sent. You can even try to send it via URL, i.e. by adding ?rest_api_key=YOURKEY



carusyte
January 12, 2017

THAT WORKS!

I should have asked 8 hours earlier.

The header in the table just kept me from suspecting that it can actually be a query parameter…


fetchAllRecords.png

Igor Petrushenko
January 12, 2017

Great to hear that! Yes, please, do not waste your time, we always here to help.



Reply:

File attachment (max 10MB)




Share the discussion in the social networks:





Tags

#Android

#CSV

#Can't be blank

#Excel

#Export

#Google

#HIPAA Compliance

#HTML

#IP

#Import

#Mobile

#PCI compliant

#QuintaDB

#SMS

#URL

#access rights

#account

#actions

#activation

#activity

#advanced options

#api

#attach

#autocomplete

#autoincrement

#background

#backup

#birthday

#blocked

#boolean

#browser

#button

#calendar

#captcha

#chart

#checkbox

#clone

#close the form

#cms

#color

#column

#conditional formatting

#confirm

#constant

#cookies

#country

#crm

#css

#custom

#data security

#database

#date

#date & time

#date format

#description

#dropdown

#dublicate

#duplicate

#dynamic form

#email

#example

#extract

#field

#field names

#field type

#file

#file upload

#filter

#font

#form

#form builder

#formatting

#formula

#forum

#free

#ftp

#gap

#geolocation

#grouping

#horizontal

#id

#iframe

#images

#in-place editing

#instruction

#integration

#invite

#java

#js

#language

#limits

#link forms

#links

#location

#log

#login

#logo

#map

#mc access

#members

#moved form

#moved project

#ms access

#multi-input

#multiline field

#multipage form

#multiple

#multiple forms

#mysql

#new features

#new window

#newsletter

#not empty

#notification

#number field

#number of records per page

#number separator

#numbered column

#offer

#offline

#operand

#page break

#partnership form

#password

#payment

#pdf

#phone number

#plan

#popup

#portal

#position

#print

#quotation tool

#radio button

#records

#redirect

#referral program

#registration

#regular expressions

#relationship

#remind

#remove

#rename

#report

#rules

#script

#scroll

#search

#security data

#security menu

#server

#service

#sheets

#show/hide

#side by side

#signature

#size

#sort

#special character

#state

#storage

#subscribe

#suggestion

#support

#table

#team

#template

#text

#text direction

#time

#total

#trial

#tutorial

#two-column

#update column

#update records

#updates

#upload file

#users

#validation

#video

#view

#widget

#window

#wysiwyg

#youtube

#zip code