• snejana
  • NEWBIE
  • 30 Points
  • Member since 2013

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 6
    Replies

Hi all, please, help.

 

I need to use REST for creating new portal user
I use apigee.com.
I create class and GET works well, but I have problems with POST.

 

@RestResource(urlMapping='/WSPortalUser/*')
global with sharing class WSPortalUser{

    @HttpGet
    global static User doGet(){
        RestRequest req = RestContext.request;
        RestResponse res = RestContext.response;
        String userId = req.requestURI.substring(req.requestURI.lastIndexOf('/')+1);
        User result = [SELECT Id, Name FROM User WHERE Id = :userId];
        return result;
    }
  
    @HttpPost
    global static String doPost(String name){
    	return name;
    }
}

 GET:

https://na14.salesforce.com/services/apexrest/WSPortalUser/005i0000000M2lB

HTTP/1.1 200 OK
Date:
Thu, 13 Jun 2013 02:44:33 GMT
Content-Length:
144
Content-Type:
application/json;charset=UTF-8

{
  "attributes":  {
    "type": "User",
    "url": "/services/data/v24.0/sobjects/User/005i0000000M2lBAAS"
  },
  "Name": "Admin",
  "Id": "005i0000000M2lBAAS"
}

 POST:

https://na14.salesforce.com/services/apexrest/WSPortalUser?name=TestName

HTTP/1.1 400 Bad Request
Date:
Thu, 13 Jun 2013 02:53:18 GMT
Content-Length:
118
Content-Type:
application/json;charset=UTF-8

[
   {
    "message": "The HTTP entity body is required, but this request has no entity body.",
    "errorCode": "JSON_PARSER_ERROR"
  }
]

 What do I do wrong? Please, any ideas.

Hi all.

 

I have logos.zip into static resource, which contains images with names: 'first.jpg' and 'second.jpg'.
'first' and 'second' are variables, which I retrieve from some field in custom object.

 

<apex:variable var="propertySlide" value="{!property.PropertyCode__c}.png" />
<apex:image url="{!URLFOR($Resource.logos, propertySlide)}" />

I need to be sure that if this field was empty or, for example, it equals 'third', I shouldn't see doesn't found image icon.

 

 

What should I need to do?

Hi all, please, help.

 

I need to use REST for creating new portal user
I use apigee.com.
I create class and GET works well, but I have problems with POST.

 

@RestResource(urlMapping='/WSPortalUser/*')
global with sharing class WSPortalUser{

    @HttpGet
    global static User doGet(){
        RestRequest req = RestContext.request;
        RestResponse res = RestContext.response;
        String userId = req.requestURI.substring(req.requestURI.lastIndexOf('/')+1);
        User result = [SELECT Id, Name FROM User WHERE Id = :userId];
        return result;
    }
  
    @HttpPost
    global static String doPost(String name){
    	return name;
    }
}

 GET:

https://na14.salesforce.com/services/apexrest/WSPortalUser/005i0000000M2lB

HTTP/1.1 200 OK
Date:
Thu, 13 Jun 2013 02:44:33 GMT
Content-Length:
144
Content-Type:
application/json;charset=UTF-8

{
  "attributes":  {
    "type": "User",
    "url": "/services/data/v24.0/sobjects/User/005i0000000M2lBAAS"
  },
  "Name": "Admin",
  "Id": "005i0000000M2lBAAS"
}

 POST:

https://na14.salesforce.com/services/apexrest/WSPortalUser?name=TestName

HTTP/1.1 400 Bad Request
Date:
Thu, 13 Jun 2013 02:53:18 GMT
Content-Length:
118
Content-Type:
application/json;charset=UTF-8

[
   {
    "message": "The HTTP entity body is required, but this request has no entity body.",
    "errorCode": "JSON_PARSER_ERROR"
  }
]

 What do I do wrong? Please, any ideas.

Hi all.

 

I have logos.zip into static resource, which contains images with names: 'first.jpg' and 'second.jpg'.
'first' and 'second' are variables, which I retrieve from some field in custom object.

 

<apex:variable var="propertySlide" value="{!property.PropertyCode__c}.png" />
<apex:image url="{!URLFOR($Resource.logos, propertySlide)}" />

I need to be sure that if this field was empty or, for example, it equals 'third', I shouldn't see doesn't found image icon.

 

 

What should I need to do?

I'm having trouble saving from eclipse, and receive following error:

 

Save error: Unable to perform save on all files: Destination URL not reset. The URL returned from login must be set in the SforceSerice

 

The thing is, I do not continuesly get it, it get it some hours, in a row, and then I don't anymore. Without changing any sf login settings. Sometimes it passes by by restarting eclips, sometimes it doesn't.

 

I've got running projects on different sf organizations, and sometimes i can't save to one because of this error, but have no trouble saving to another. Trying to look up the error, i mostly came across problems with API webservice connection problems, and no mentions of IDE problems.

 

Does anyone know what the issue might be, and how to fix/avoid it ?