Jump to content

More Universal Module Documentation?


wdq

Recommended Posts

Hello,

 

I'm in the process of actually using Blesta for automating some provisioning of services. I'm trying to do this with the Universal Module, but the documentation for it really isn't all that great. http://docs.blesta.com/display/user/Universal+Module

 

Basically I want to have a custom field in the order form that's Game Username or game_username. I want it to be a simple text field, and when the product is activated I would like it to send a HTTP POST request with some information over to a server that will handle the rest. 

 

I've attached an image of what I have so far. I'm not quite sure how to create the Post URL/Email field along with the HTTP Code and Response Contains fields.

 

The following curl command works with the script I have. So if anyone knows how to replicate it in Blesta that would be great.

 

curl -d "username=game_username&rank=VIP" https://example.com/manage/index.php
 
Thanks.
 
y4SVunf.png
Link to comment
Share on other sites

Looks like you've just about got it, though the variables are not available in the URL (but that's an awesome idea). They'll automatically be sent via POST, however.

 

From your curl request you've specified both parameters to be sent via POST. To set rank as a variable configure it as a Secret or Hidden type, and specify it's value as VIP.

 

Most HTTP requests respond with a 200 response code. If a 200 response indicates success for that URL enter 200 as the HTTP Code. If, instead, the URL responds with some string that contains "success" or something similar, set that string in the Response Contains field.

Link to comment
Share on other sites

Looks like you've just about got it, though the variables are not available in the URL (but that's an awesome idea). They'll automatically be sent via POST, however.

 

From your curl request you've specified both parameters to be sent via POST. To set rank as a variable configure it as a Secret or Hidden type, and specify it's value as VIP.

 

Most HTTP requests respond with a 200 response code. If a 200 response indicates success for that URL enter 200 as the HTTP Code. If, instead, the URL responds with some string that contains "success" or something similar, set that string in the Response Contains field.

 

I am able to get it to communicate with the server when I have this as the HTTP code: HTTP/1.1 200 OK

 

However I'm getting a 400 HTTP code back from the server (bad request.) It looks like it may be because Blesta is using post instead of POST. Does anyone have any insight into this?

 

x.x.x.x - - [28/Sep/2013:11:56:23 -0500] "post /manage/index.php HTTP/1.1" 400 166 "-" "-"

Link to comment
Share on other sites

I am able to get it to communicate with the server when I have this as the HTTP code: HTTP/1.1 200 OK

 

The HTTP code you enter in Blesta should only be a number.

 

However I'm getting a 400 HTTP code back from the server (bad request.) It looks like it may be because Blesta is using post instead of POST. Does anyone have any insight into this?

 

x.x.x.x - - [28/Sep/2013:11:56:23 -0500] "post /manage/index.php HTTP/1.1" 400 166 "-" "-"

 

I don't think that's the issue. Without knowing the API requirements for that particular resource I can't really say what the problem is (a 400 response is vague). It could be that something else that's posted along with the request is throwing it off.

 

As a sort of work around, if necessary, you could have the universal module post to a script you create to capture the data and pass along only the variables the API requires using curl, for example.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...