HTTP Make A Request / API call 200 error

Hi!

I’m trying to connect to an API that will allow me to resize generated images using the HTTP make a request.

The API documentation is here (http://bigjpg.com/)) and instructs me to use this code:
To Enlarge API

curl F ‘conf={“style”: “art”, “noise”: “3”, “x2”: “1”, “input”: “YOUR_IMAGE_URL”}’
-H ‘X-API-KEY:“YOUR API KEY”’
https://bigjpg.com/api/task/

conf is JSON format

  • style can be ‘art’, ‘photo’ which means ‘cartoon illustration’, ‘photo’
  • noise can be ‘-1’, ‘0’, ‘1’, ‘2’, ‘3’ which means ‘None’, 'Low, ‘Medium’, ‘High’, ‘Highest’
  • x2 can be ‘1’, ‘2’, ‘3’, ‘4’ which means 2x, 4x, 8x, 16x
  • input your enlarge image url

I have filled out the fields for the HTTP make a request module as outlined in the attached screenshots and the inputs and output are as follows:

INPUT:
Bundle 1Collection
Self-signed certificate empty
Query StringArray
Empty
URL https://bigjpg.com/api/task/
Request content {
“style”: “art”,
“noise”: “1”,
“x2”: “4”,
“input”: “https://oaidalleapiprodscus.blob.core.windows.net/private/org-TAWtSCfHzot3xJG7ZjrrhiAX/user-MaDMTUnPnKsvPiwb1SuqTnM3/img-WogKZgoG9nJhLkSITL7tsCyb.png?st=2023-04-01T23%3A34%3A20Z&se=2023-04-02T01%3A34%3A20Z&sp=r&sv=2021-08-06&sr=b&rscd=inline&rsct=image/png&skoid=6aaadede-4fb3-4698-a8f6-684d7786b067&sktid=a48cca56-e6da-484e-a814-9c849652bcb3&skt=2023-04-01T19%3A44%3A28Z&ske=2023-04-02T19%3A44%3A28Z&sks=b&skv=2021-08-06&sig=nKn9n4HcSwQUwYszVaOlewg64NR7RkIHZIAXcr21YiY%3D
}
Request compressed content true
Method post
HeadersArray
1Collection
name x-api-key
value MY API KEY
Timeout empty
Use Mutual TLS false
Password empty
User name empty
Body type raw
Content type application/json
Serialize URL false
Share cookies with other HTTP modules false
Parse response true
Follow redirect true
Disable serialization of multiple same query string keys as arrays false
Follow all redirect false
Reject connections that are using unverified (self-signed) certificates true

OUTPUT:
Bundle 1Collection
Status code 200
HeadersArray
1Collection
name server
value nginx
2Collection
name date
value Sun, 02 Apr 2023 00:34:21 GMT
3Collection
name content-type
value application/json; charset=UTF-8
4Collection
name content-length
value 25
5Collection
name connection
value close
Cookie headersArray
Empty
DataCollection
status param_error
fileSize 25

As you can see I am received a 200 param_error, which seems to indicate that some of the process if correct but some parameters are wrong.

I’ve tried different URLS for the image for {{68.data.url}}(however I’m not sure if I am inputting it in the proper formatting).

Also I have hidden / replaced my API key here with MY API KEY, however I assure you that I have entered the API key into the module.

Is there any suggestion you have to make this work?


When asking your question, please include:

:footprints: The steps you have taken
:camera_flash: Relevant screenshots
:link: Any links you have
[ Code { "and": "JSON", "in" : "code block"} ]
:x: Exclude Personal Information.

The -F flag in cURL corresponds to form i.e multipart/form-data. Try this in your HTTP Module instead,

1 Like

Thanks for the suggestion.

I tried it both as you suggested and as multipart/form data and still get error 200 param_error. Any other ideas welcome! This is a real head scratcher.

I tried with the default data that was in the original request in the documentation and I was getting the expected results.

Can you try this blueprint :

blueprint (30).json (9.8 KB)

Also, I am getting the same error though if I change the x2 to a higher value other than 2. I think it might be due to the restriction on BigJPG end, not sure if that is the case though.

1 Like

This is great. I managed to get it to work as you instructed but am puzzled on how to retrieve the file.

I’ve set up a HTTP GET request, trying to follow what the API instructions may be saying:

Result Query API Python Demo

curl https://bigjpg.com/api/task/f3d6d584675848ac9a2389352ea1a9f9

  • yellow part is the task id returned by the API above

That seems to be succeeding, however it does not return a URL. And when I connect that to a HTTP get a file module and direct it at the data output I get a BundleValidationError.

Is my HTTP GET request the incorrect thing to do?

Any thought here? I appreciate your help - you’ve been a real hero so far.



It is due to delay in file conversion at BigJPG end. Not sure how it works API wise but you might consider getting in contact with BigJPG team on how long it takes to get the conversion done.

I am not sure whether it will work 100% all the time, what you can do is add a Sleep Module after the Initial Conversion HTTP module, and then after 10/20/30 seconds try to fetch the task.

Not sure, it it is related but in the initial HTTP module for conversion, you get a field named minute, which I believe denotes how long it takes the task to complete in BigJPG end?

3 Likes

You’re a genius. That was totally it. Thank you soooo much! :slight_smile: